To List or Not to List

<cfset aList = "10">
<!--- aList can become something like the following 
<cfset aList = "10,2,11,24"> or
<cfset aList = "1,10,2,11,24">

<cfset e = "10">


the above output is always consistently gt 0 (e FOUND)

But the following similar listFind fails.

<cfquery name="getD">
 select col1, col2
 from tbl
 where cond1 = 'aValue'
<cfquery name="getE" dbtype="query">
	select col1
	from getD
<cfset qList = valueList(getE.col1)>

The qList value is exactly like the above aList 
and it can be just one list element or multiple element, each is a simple value.

<cfset e = "10">
the above e var's value can be "10" or "7" or whatever number


the above output is always consistently 0 (e NOT FOUND)

How come?


The last listFind() in your code is searching for the value in aList instead of qList.

good catch, it’s my typo, the second output is for qList.

Having said that, I’ve solved it with another solution.

1 Like