I know this topic has gone far since we last reviewed together, but I wanted to touch on this subject quickly.
<cfset variables.list1 = "Agree,Disagree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree"> <cfset variables.list2 = '#ValueList(getincreasedKnowledge.INCREASEDKNOWLEDGE)#'> List 1 is a defined set of values or 'column headers' in a table. (HTML) List 2 is a resultset of values (valuelist()) or 'Row values' in a table. (query) By doing a 'ValueList()' for list2 you are telling the code to make a list of all of the resultset values for a specific column that was returned. By checking the second list for a matching value to the first, you are comparing 'column header' strings to 'row result values (possibly numeric?)'. ---------------------------------- William Seiter -----Original Message----- From: Torrent Girl [mailto:[email protected]] Sent: Thursday, December 11, 2014 5:42 AM To: cf-talk Subject: Re: Creating columns that aren't included in a query result William, your suggestion is what I went with it initially: Here is my code: <cfoutput> <cfloop index="i" list="#variables.list1#"> <cfif listFind(variables.list2, i)> <td align="center"><cfoutput>#getimprovedCompetence.TOTALIMPROVEDCOMPETENCE#</cf output></td> <cfelse> <td align="center">0</td> </cfif> </cfloop> </cfoutput Here are my lists: <cfset variables.list1 = "Agree,Disagree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree"> <cfset variables.list2 = '#ValueList(getincreasedKnowledge.INCREASEDKNOWLEDGE)#'> The problem is for the cells that are supposed to have a value, it puts ALL of the values in these cells. This is where I got stuck. >It seems illogical that a column would not exist from the query. Could >you post the query that is being run? > >As to your display issue... ><cfif structKeyExists([qName],'[colName]')> > <td>#[qName].[colName]#</td> ><cfelse> > <td>0</td> ></cfif> > >One of these per column... > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359832 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

