Link to home
Start Free TrialLog in
Avatar of SiobhanElara
SiobhanElaraFlag for United States of America

asked on

How do you check to see if query results contain a string?

I have two queries; the first one simply returns a list (of, say, all letters of the alphabet) and the second  returns a varying number of letters. What I want to do is print out the results of the first query highlighting the ones that are contained in the second query. I'm guessing it would be done something like the following:

<cfloop query="qAlphabet">
   <cfif [qSelectLetters contains qAlphabet.letter]><b></cfif>
   #qAlphabet.letter#
   <cfif [qSelectLetters contains qAlphabet.letter]></b><cfif>
   <br/>
</cfloop>

But I'm unsure of how to phrase the part in the brackets. I've done it by setting a string (looping through query 2, to give something like "a,c,g,w" and seeing if that string contains qAlphabet.letter, but it seems like that would be excessively huge if the queries were involving blocks of text, not just letters.
ASKER CERTIFIED SOLUTION
Avatar of danrosenthal
danrosenthal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial