Michael,

I may not fully understand your situation, but this works for me. I
manually created 2 queries to simulate your data: one with the rids
and taids that the user selected; another simulating the target
audience reference table (only did 5 of the 9).

The qAudienceValues query has 3 of the 5 options. I convert those to a
list with ValueList(). Then just loop through the TargetAudience
query, outputting as needed.

<!--- Query of user selected options --->
<cfset qAudienceValues = QueryNew('rid,taid')>
<cfset QueryAddRow(qAudienceValues,3)>
<cfset QuerySetCell(qAudienceValues,'rid',1,1)>
<cfset QuerySetCell(qAudienceValues,'taid',1,1)>
<cfset QuerySetCell(qAudienceValues,'rid',2,2)>
<cfset QuerySetCell(qAudienceValues,'taid',3,2)>
<cfset QuerySetCell(qAudienceValues,'rid',3,3)>
<cfset QuerySetCell(qAudienceValues,'taid',5,3)>

<!--- Query of Target Audiences --->
<cfset qTargetAudience = QueryNew('taid,targetAudience')>
<cfset QueryAddRow(qTargetAudience,5)>
<cfset tmpList = "General
Public(Adults),Children&nbsp;&frasl;&nbsp;Youth,Seniors,Elected
Officials&nbsp;&frasl;&nbsp;    Policy Makers,Extension
Educators&nbsp;&frasl;&nbsp;Teachers">
<cfloop list="#tmpList#" index="i">
        <cfset 
QuerySetCell(qTargetAudience,'taid',ListFind(tmpList,i),ListFind(tmpList,i))>
        <cfset 
QuerySetCell(qTargetAudience,'targetAudience',i,ListFind(tmpList,i))>
</cfloop>

<cfoutput>
<cfset AudienceTAIDs = ValueList(qAudienceValues.taid) />
<cfloop query="qTargetAudience">
<input type="checkbox" <cfif ListFind(AudienceTAIDs,taid)>checked</cfif>>
#targetAudience#<br />
</cfloop>
</cfoutput>


-- 
Matt Williams
"It's the question that drives us."

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:253255
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to