Question
Highlighted Expired rows on cfgrid
Hi,
I'm using cfgrid and cfgridcolumn to display the data retreived from my query. The problem is that the textColor attribute doesn't go through each element retrieved to decide to give the text colour or not.
Here is my code:
<cfquery name="LicenseInfo" datasource="####" >
SELECT csi## AS CSI,
product_description,
license_metric,
contact,
location,
server_name,
os,
version,
support_expires,
license_id
From Oracle_licenses
Order BY to_number(CSI), product_description
</cfquery>
<cfquery name="exp_status" datasource="####" >
select csi##, support_expires,
case
when support_expires is null then 'EMPTY'
when nvl(support_expires,sysdate + 1) > sysdate then 'CURRENT'
else 'EXPIRED'
end as support_status
From oracle_licenses
Order BY csi##
</cfquery>
<cfform action="update_contact_e.cfm" >
<cfset x = 0>
<!--- Creates a grid based on the LicenseInfo query and displays the data within the form--->
<!--- Add delete tage in cfgrid to enable delete function --->
<cfgrid name="LicenseGrid" query="LicenseInfo" selectmode="edit" insert="yes" height="500" width="1100">
<cfgridcolumn name="CSI" header="CSI" width="60" select="yes" type="numeric" >
<cfgridcolumn name="product_description" width="405" select="yes">
<cfgridcolumn name="license_metric" select="yes">
<cfgridcolumn name="contact" width="150" select="yes">
<cfgridcolumn name="location" width="75" select="yes" type="string_nocase">
<cfgridcolumn name="server_name" width="100" select="yes">
<cfgridcolumn name="Os" header="OS" width="50" select="yes">
<cfgridcolumn name="version" width="75" select="yes">
<cfgridcolumn name="support_expires" width="110" select="yes" mask="YYYY/MM/DD" >
<cfgridcolumn name="license_id" display="no" select="no">
</cfgrid>
<p><br />
<cfinput type="submit" value="Submit" name="submit"/>
<hr size="2" width="100%" align="left">
</cfform>
I need it change the whole row (or just the cell for simplicity sake) to another colour when the date on the "support_expires" column is expired.
In other versions of the manual, you're supposed to be able to put in a condition or expression in the textColor attribute, for some reason it only compares the first (or the initial) element in that expression.
for example, i have tried:
textColor = "IIF(dateCompare(now(),support_expires) eq 0, red, blue)"
textColor = "iif(compareNoCase("expired", support_status) eq 0, red, blue )"
and a few other similar variations, the results are either there's no effect (That is, the text is black, not blue or red), or the whole column is the same color.
This should be a simple operation, I don't know why it does not work. Please help. Thanks.
I'm using cfgrid and cfgridcolumn to display the data retreived from my query. The problem is that the textColor attribute doesn't go through each element retrieved to decide to give the text colour or not.
Here is my code:
<cfquery name="LicenseInfo" datasource="####" >
SELECT csi## AS CSI,
product_description,
license_metric,
contact,
location,
server_name,
os,
version,
support_expires,
license_id
From Oracle_licenses
Order BY to_number(CSI), product_description
</cfquery>
<cfquery name="exp_status" datasource="####" >
select csi##, support_expires,
case
when support_expires is null then 'EMPTY'
when nvl(support_expires,sysdate + 1) > sysdate then 'CURRENT'
else 'EXPIRED'
end as support_status
From oracle_licenses
Order BY csi##
</cfquery>
<cfform action="update_contact_e.cfm" >
<cfset x = 0>
<!--- Creates a grid based on the LicenseInfo query and displays the data within the form--->
<!--- Add delete tage in cfgrid to enable delete function --->
<cfgrid name="LicenseGrid" query="LicenseInfo" selectmode="edit" insert="yes" height="500" width="1100">
<cfgridcolumn name="CSI" header="CSI" width="60" select="yes" type="numeric" >
<cfgridcolumn name="product_description" width="405" select="yes">
<cfgridcolumn name="license_metric" select="yes">
<cfgridcolumn name="contact" width="150" select="yes">
<cfgridcolumn name="location" width="75" select="yes" type="string_nocase">
<cfgridcolumn name="server_name" width="100" select="yes">
<cfgridcolumn name="Os" header="OS" width="50" select="yes">
<cfgridcolumn name="version" width="75" select="yes">
<cfgridcolumn name="support_expires" width="110" select="yes" mask="YYYY/MM/DD" >
<cfgridcolumn name="license_id" display="no" select="no">
</cfgrid>
<p><br />
<cfinput type="submit" value="Submit" name="submit"/>
<hr size="2" width="100%" align="left">
</cfform>
I need it change the whole row (or just the cell for simplicity sake) to another colour when the date on the "support_expires" column is expired.
In other versions of the manual, you're supposed to be able to put in a condition or expression in the textColor attribute, for some reason it only compares the first (or the initial) element in that expression.
for example, i have tried:
textColor = "IIF(dateCompare(now(),support_expires) eq 0, red, blue)"
textColor = "iif(compareNoCase("expired", support_status) eq 0, red, blue )"
and a few other similar variations, the results are either there's no effect (That is, the text is black, not blue or red), or the whole column is the same color.
This should be a simple operation, I don't know why it does not work. Please help. Thanks.