Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Parsing query variable

New Here ,
Apr 22, 2008 Apr 22, 2008
I am facing a problem while parsing query output variable.

Scenario:-
I have stored session variable name as the column value of a table.
Now I have used cfquery tag and get the result column value which is the session variable name. But cold fusion didn't parse that session variable with its actual value.

Step1- Table view by using cfdump tag
query - Top 1 of 1 Rows
PARAMETERNAME - PARAMETERVALUE
1 @matterspacename - #SESSION.Matter_space_Name#

Step2- Using cfquery tag to fetch data from table:-

<cfquery name="qSendNotification" datasource="#Database_DSN#">
select
ParameterName,
ParameterValue
from
Tbl_EventParameterDetails
where
NotificationEventID = 1
and IsActive = 1
</cfquery>

Step3- Now using result of cfquery output.
<cfset event_data= #qSendNotification.ParameterValue#>

Step4- When I used cfdump to display result value its shows as under:-

<cfdump var="#event_data#">

output:- #SESSION.Matter_space_Name#

Instead of parsing actual value of the session variable it displays the session variable name.

Please help me, How to parse this session value or if my code has some error, please suggest me any other way to handle this situation.

Thanks in advance




454
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 22, 2008 Apr 22, 2008
In short when i dump the query result it just shows the session variable name as it is [#Session.Matter_space_Name#] instead of showing the actual session value of that variable.

It simply comes down to this: you have stored the string "#Session.Matter_space_Name#" as data in the the parameterValue column. If that is not what you intended, go back to the code that inserted the data and change the value. Or perhaps, you intended to store the string Session.Matter_space_Name as parameterValue so...
Translate
LEGEND ,
Apr 22, 2008 Apr 22, 2008
What happens when you dump the query? Do you see what you expected to see?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2008 Apr 22, 2008
when i dump the query it shows me the value that is stored in DB i.e. #Session.Matter_space_Name#.
But when i store this value into a variable and then dump that variable it won't show me the actual value of this session variable's value.

In short when i dump the query result it just shows the session variable name as it is instead of showing the actual session value of that variable.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 22, 2008 Apr 22, 2008
deepak.srivastav wrote:
>
> In short when i dump the query result it just shows the session variable name
> as it is instead of showing the actual session value of that variable.
>

Can you show your code. It looks like you are needing CF to double
evaluate a variable. I.e. Evaluate a variable to produce a variable to
be evaluated for a value.

This can be done, but I'm not sure what your code is doing where in
order to make a suggestion.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2008 Apr 22, 2008
This is my actual code from which i m getting result from cfquery and then concatinating it into a variable and then passing it to the stored procedure.

<cfquery name="qSendNotification" datasource="#Database_DSN#">
select
epd.ParameterName,
epd.ParameterValue
from
Tbl_NotificationEventParamaters as nep
inner join Tbl_EventParameterDetails as epd
on nep.EventParameterID = epd.EventParameterID
where
NotificationEventID = #NotificationEventID#
and nep.IsActive = 1
and epd.IsActive = 1
</cfquery>

<!--- concatinating parametername & parametervalue and appending it into event_datal, parametervalue holds session variable names--->
<cfset event_data="">

<cfloop query="qSendNotification">
<cfset event_data = event_data & qSendNotification.ParameterName & "=" & #qSendNotification.ParameterValue# & "|">
</cfloop>

<cfstoredproc datasource="#Database_DSN#" procedure="stp_SendNotifictaion">
<cfprocparam type="in" value="#NotificationEventID#" dbvarname="NotificationEventID" cfsqltype="cf_sql_integer">
<cfprocparam type="in" value="#event_data#" dbvarname="NotificationEventData" cfsqltype="cf_sql_varchar">
<cfprocresult name="ResultSP">
</cfstoredproc>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 22, 2008 Apr 22, 2008
deepak.srivastav wrote:
> This is my actual code from which i m getting result from cfquery and then
> concatenating it into a variable and then passing it to the stored procedure.
>


Ok and now what is an example of what this code produces and what is an
example of what you WANT it to produce?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 22, 2008 Apr 22, 2008
In short when i dump the query result it just shows the session variable name as it is [#Session.Matter_space_Name#] instead of showing the actual session value of that variable.

It simply comes down to this: you have stored the string "#Session.Matter_space_Name#" as data in the the parameterValue column. If that is not what you intended, go back to the code that inserted the data and change the value. Or perhaps, you intended to store the string Session.Matter_space_Name as parameterValue so that you can later get the value with

evaluate(qSendNotification.ParameterValue).



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2008 Apr 22, 2008
LATEST
Its working...
Tons of thanks 🙂
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources