House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

ON-THE-FLY FILTERS

Author:
Dave Jemison
06/28/2012 11:39 AM

Have you tried the following? SELECT tblY.fldX FROM tblY #PreserveSingleQuotes(SESSION.F)#; > CF8 > > SELECT tblY.fldX > FROM tblY > WHERE tblY.fldA='something'; > > That works okay. But I want to set the WHERE clause on-the-fly. So the > user selects the filter (via a form) and the result is stored as > <cfset SESSION.F = "WHERE tblY.fldA='" & FORM.Result & "'"> (where > FORM.Result = something) > > Do a cfoutput to check SESSION.F and that shows WHERE tblY. > fldA='something'    All is well. > > So, my code is > > SELECT tblY.fldX > FROM tblY > #SESSION.F#; > > The problem is, it now displays as > > SELECT tblY.fldX > FROM tblY > WHERE tblY.fldA="something"; > > And that throws an error. Why does SESSION.F display correctly in the > cfoutput but CF8 changes the ' to " when I use it in cfquery ?


Search cf-talk

June 20, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
             1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30             

Designer, Developer and mobile workflow conference