If I understand correctly

Select response1 from [table]

The resulting Query can equal 'response1' == 'Agree' or 'Disagree' or
'Neither Agree nor Disagree' or 'Strongly Agree' or 'Strongly Disagree'

Then you loop over the results from the query and (I am guessing here) you
want to place an 'X' in the box under the correct header?

Simplest I can think of would be

<cfoutput query="[qname]">
        <tr>
        <cfswitch expression="#[qname].response1#">
                <cfcase value="Agree">
                        <td>X</td><td></td><td></td><td></td><td></td>
                </cfcase>
                <cfcase value="Disagree">
                        <td></td><td>X</td><td></td><td></td><td></td>
                </cfcase>
                <cfcase value="Neither Agree nor Disagree">
                        <td></td><td></td><td>X</td><td></td><td></td>
                </cfcase>
                <cfcase value="Strongly Agree">
                        <td></td><td></td><td></td><td>X</td><td></td>
                </cfcase>
                <cfcase value="Strongly Disagree">
                        <td></td><td></td><td></td><td></td><td>X</td>
                </cfcase>
        </cfswitch>
        </tr>
</cfoutput>


----------------------------------
William Seiter

-----Original Message-----
From: Torrent Girl [mailto:[email protected]] 
Sent: Wednesday, December 10, 2014 4:03 PM
To: cf-talk
Subject: Creating columns that aren't included in a query result


I am hoping I can explain this correctly.

I have a table which houses responses to a survey.

The columns can have any of the following values:

Agree,Disagree,Neither Agree nor Disagree,Strongly Agree,Strongly Disagree

I have a table with the headers equal to all of the values above.

I have a 2nd row that loops through the query and adds a cell in the row for
each value:

EX: <td>#query.value#</td>

Here is my problem:

There are times when not all of the values exists, so I don't have enough of
the dynamic cells in the row. EX: I have a header called "Agree" but the
value "agree" is not returned from the query so it messes up the row.

My question is how can I create a "fake" column from the query OR create an
empty cell in the row if a value doesn't exist?

NOTE: The values don't exist so I can "test for existence" if that makes
sense.

Thanks in advance.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:359804
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to