Ask a Question related to Coldfusion Component Development, Design and Development.
-
PARSING A QUERY OF QUERY WITH A VARIABLE VALUE 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.
[email protected] Guest
-
Using variable in sql query
Hello again, I'm trying to run an sql query using a string as in the following: <cfset string = "address1=' #evaluate("form.param#count#")# ',... -
Trouble with url variable in query
Hi there, I'm having trouble getting a database query that uses url variables to work. The query is <cfquery Name="Display"... -
Query of Queries on query New type query
In CF5 we have a page that creates a query, using queryNew and querySetCell and the like, we then used dbtype="query" and gave it's name so we could... -
Help with variable query?
I'm having an arbitrary query input by the user, then to make that query into an excel file it must be put into a table similar to below. Since I... -
Parsing MySQL query return
Hey All, I have a question regarding parsing text from a MySQL query. Basically, I have several paragraphs of text in a field in MySQL. I run a... - TroubZ #2
Re: PARSING A QUERY OF QUERY WITH A VARIABLE VALUE 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.
[email]zdenek@g[email protected][/email] 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.TroubZ Guest
-
Re: PARSING A QUERY OF QUERY WITH A VARIABLE VALUE 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.
>
>
>
> [email][email protected][/email] 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.[email protected] Guest
- Unregistered #4
Parsing a query of query with a variable value Try using single quotes in your WHERE clause instead of double.
Unregistered Guest




