PARSING A QUERY OF QUERY WITH A VARIABLE VALUE

Posted: 09-15-2006, 04:39 PM
On my first page the user selects a project. I am using the variable
SelectedProject:
<cfset SelectedProject = '<cfoutput>#ArrayGroupAwards[8]#</cfoutput>'>

I've tried whichever way to tease relevant data from my database by
making the selected project a necessary condition for the data to
qualify for inclusion. Here's one example:

Query Of Queries syntax error.
Encountered "Project. Incorrect conditional expression, Incorrect
conditional expression, Lexical error at line 0, column 0. Encountered:
"\"" (34), after : ""

The error occurred in
C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
line 414
Called from
C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
line 1
Called from
C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
line 414
Called from
C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
line 1

412 : SELECT Project, FirstName, LastName
413 : FROM Nominations
414 : WHERE Project = "#SelectedProject#"
415 : </cfquery>
416 : <cfset counter = 0 />

(Of course it works when I substitute the value of #SelectedProject# in
the place of the variable. I just don't know how to the programming
code substitute it in the WHERE statement so that it works.)

As witnnessed by the following code line, my ColdFusion debugger
somehow knows the properly parsed name of the project passed to the
second page and even shows it in the WHERE statement:

SQL SELECT Project, FirstName, LastName FROM Nominations
WHERE Project = "<cfoutput>Fox River Team </span></cfoutput>"

Why then am I getting the error?

I have also tried, among other things,
WHERE Project IN (<cfqueryparam cfsqltype="cf_sql_longvarchar"
value="#SelectedProject#" list="yes" separator=",">)
This does not result in an error, but in no results being displayed at
all.

Can you, would you help? Thanks.

Reply With Quote

Responses to "PARSING A QUERY OF QUERY WITH A VARIABLE VALUE"

TroubZ
Guest
Posts: n/a
 
Re: PARSING A QUERY OF QUERY WITH A VARIABLE VALUE
Posted: 09-17-2006, 11:59 PM
Hey there zdenek,

Firstly you might want to try the following for your cfset:
<cfset SelectedProject = '#ArrayGroupAwards[8]#'>

You don't need the <cfoutput> tags when assigning variables.

Now if for some reason - that doesn't fix you up,
please include a few more details in your email.
Ie. How you create the instance of your CFC
Whether or not the code you're running is in a function,
How you're calling / using the function.

Any and all of these things could have an effect a successful outcome.



zdenek@gmail.com wrote:
> On my first page the user selects a project. I am using the variable
> SelectedProject:
> <cfset SelectedProject = '<cfoutput>#ArrayGroupAwards[8]#</cfoutput>'>
>
> I've tried whichever way to tease relevant data from my database by
> making the selected project a necessary condition for the data to
> qualify for inclusion. Here's one example:
>
> Query Of Queries syntax error.
> Encountered "Project. Incorrect conditional expression, Incorrect
> conditional expression, Lexical error at line 0, column 0. Encountered:
> "\"" (34), after : ""
>
> The error occurred in
> C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
> line 414
> Called from
> C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
> line 1
> Called from
> C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
> line 414
> Called from
> C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
> line 1
>
> 412 : SELECT Project, FirstName, LastName
> 413 : FROM Nominations
> 414 : WHERE Project = "#SelectedProject#"
> 415 : </cfquery>
> 416 : <cfset counter = 0 />
>
> (Of course it works when I substitute the value of #SelectedProject# in
> the place of the variable. I just don't know how to the programming
> code substitute it in the WHERE statement so that it works.)
>
> As witnnessed by the following code line, my ColdFusion debugger
> somehow knows the properly parsed name of the project passed to the
> second page and even shows it in the WHERE statement:
>
> SQL SELECT Project, FirstName, LastName FROM Nominations
> WHERE Project = "<cfoutput>Fox River Team </span></cfoutput>"
>
> Why then am I getting the error?
>
> I have also tried, among other things,
> WHERE Project IN (<cfqueryparam cfsqltype="cf_sql_longvarchar"
> value="#SelectedProject#" list="yes" separator=",">)
> This does not result in an error, but in no results being displayed at
> all.
>
> Can you, would you help? Thanks.
Reply With Quote
zdenek@gmail.com
Guest
Posts: n/a
 
Re: PARSING A QUERY OF QUERY WITH A VARIABLE VALUE
Posted: 09-19-2006, 05:42 PM
Gavin,

Thanks for taking the time to respond.

I took out the cfoutput tags. It didn't help. I sent you the two pages
in case you have the time and the inclination to look them over for me.
:-)

TroubZ wrote:
> Hey there zdenek,
>
> Firstly you might want to try the following for your cfset:
> <cfset SelectedProject = '#ArrayGroupAwards[8]#'>
>
> You don't need the <cfoutput> tags when assigning variables.
>
> Now if for some reason - that doesn't fix you up,
> please include a few more details in your email.
> Ie. How you create the instance of your CFC
> Whether or not the code you're running is in a function,
> How you're calling / using the function.
>
> Any and all of these things could have an effect a successful outcome.
>
>
>
> zdenek@gmail.com wrote:
> > On my first page the user selects a project. I am using the variable
> > SelectedProject:
> > <cfset SelectedProject = '<cfoutput>#ArrayGroupAwards[8]#</cfoutput>'>
> >
> > I've tried whichever way to tease relevant data from my database by
> > making the selected project a necessary condition for the data to
> > qualify for inclusion. Here's one example:
> >
> > Query Of Queries syntax error.
> > Encountered "Project. Incorrect conditional expression, Incorrect
> > conditional expression, Lexical error at line 0, column 0. Encountered:
> > "\"" (34), after : ""
> >
> > The error occurred in
> > C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
> > line 414
> > Called from
> > C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
> > line 1
> > Called from
> > C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
> > line 414
> > Called from
> > C:\CFusionMX7\wwwroot\Awards\Forms\edit_GroupAward Nomination_FORM.cfm:
> > line 1
> >
> > 412 : SELECT Project, FirstName, LastName
> > 413 : FROM Nominations
> > 414 : WHERE Project = "#SelectedProject#"
> > 415 : </cfquery>
> > 416 : <cfset counter = 0 />
> >
> > (Of course it works when I substitute the value of #SelectedProject# in
> > the place of the variable. I just don't know how to the programming
> > code substitute it in the WHERE statement so that it works.)
> >
> > As witnnessed by the following code line, my ColdFusion debugger
> > somehow knows the properly parsed name of the project passed to the
> > second page and even shows it in the WHERE statement:
> >
> > SQL SELECT Project, FirstName, LastName FROM Nominations
> > WHERE Project = "<cfoutput>Fox River Team </span></cfoutput>"
> >
> > Why then am I getting the error?
> >
> > I have also tried, among other things,
> > WHERE Project IN (<cfqueryparam cfsqltype="cf_sql_longvarchar"
> > value="#SelectedProject#" list="yes" separator=",">)
> > This does not result in an error, but in no results being displayed at
> > all.
> >
> > Can you, would you help? Thanks.
Reply With Quote
 
LinkBack Thread Tools Search this Thread Display Modes
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query of Queries? artists_envy Coldfusion Database Access 3 02-25-2005 03:31 PM
Query problem part 2 tejun Coldfusion Database Access 1 02-21-2005 09:40 PM
Need SQL Query Help from Gurus ctrl+alt+delete Coldfusion Database Access 4 02-18-2005 08:20 PM
SQL query problem navee Coldfusion Database Access 14 07-23-2003 03:52 PM
query problem tejun Coldfusion Database Access 10 07-11-2003 09:21 AM