[Top] [All Lists]

Re: Best Method - Maybe Array or Structure?

Subject: Re: Best Method - Maybe Array or Structure?
From: GArlington
Date: Fri, 10 Aug 2007 01:28:23 -0700
Newsgroups: macromedia.coldfusion.cfml_general_discussion
On 9 Aug, 19:06, "NewPrism" <[email protected]> wrote:
> I have a situation where a web client answers 20-30 questions for their
> profile, but the site owner wants only 5 or 6 of the Question Answers to show
> up on the public side such as QuestionID=10 (StoreName), QuestionID=9 (Store
> Hours).
>  I can query the specified QuestionIDs and Answers fine for a unique
> locationID. But because the answers need to show up in various tables of
> various sections of the public profile page I need a convenient way to display
> the answers.
>  Currently I cfloop the query and assign the answer as the questionID which
> works fine - unless the questionID didn't exist when the client filled in 
> their
> original profile. I cannot get an IsDefined to work and the StructureKeyExists
> requires two parameters which I don't think would work.
>  Anyone with a better idea?
>  <cfloop query="location_answers">
>  <cfset Question[#QuestionID#] = "#Answer#">
>  </cfloop>
>  <! --- need method of verifying the question[9] exists --->
>  <! --- the following work unless the locationID does not have a record
> representing QuestionID = 9 --->
>  <cfoutput>
>  Location Name: #question[10]#
>  Store Hours: #question[9]#
>  </cfoutput>

Why would not <if structKeyExists(Question, 9)> work?

<Prev in Thread] Current Thread [Next in Thread>