[thelist] CFQuery sub search...

Joshua Olson joshua at alphashop.net
Fri Nov 2 12:23:21 CST 2001


Jeff's tip uses an array as an intermediate step to change:

1,5,10,12, ... 4845, 4849, 4960

into something like

1,5,10,12, ... 327, 329)
AND id IN (342, 347, 389, ..., 624, 626)
AND id IN (4679, 4690, 4845, 4849, 4960

This transformation is important because you stuff it back into the new
query, placing the new listing inside the parenthesis of the following:

SELECT [whatever]
FROM [whereever]
WHERE [however_criteria]
AND id IN (...)

What this effectively does is cause the query to use the new parameters
(which appear before this new IN clause) but only look at the PK's
identified in the list, which should be the complete set of PK's from the
previous search.

Does this answer your concern?


----- Original Message -----
From: "Susan Wallace" <susanhw at webcastle.com>
Subject: RE: [thelist] CFQuery sub search...

: If I follow you, it will take what I currently have:
: <input type="hidden" name="thepks"
: value="<cfoutput>#ValueList(Instrument.Title_ID)#"></cfoutput>
: and instead of a hidden form field, make a variable and then make chunks,
: using this syntax:
: WHERE id IN (#chunkList#)
: put it back into my search.
: How does that "string" all of them back together so that you are actually
: searching *all* of the results?
: I need to mention that my Array skills are limited at best, so if I am
: asking you to restate the obvious, I apologize. :)

More information about the thelist mailing list