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

Conditional code to see if dynamic variable exists - #Evaluate("LeftOver" & query.line)#

LEGEND ,
Nov 12, 2006 Nov 12, 2006

Copy link to clipboard

Copied

I've created a dynamic variable without any problems. I now only want to
display the variable if the variable exists or is defined. I've tried a few
variations of the code below

I cant seem to get the syntax correct. Can someone help me out?


<cfif isdefined (Evaluate("LeftOver" & query.line))>

<cfoutput>#Evaluate("LeftOver" & query.line)#</cfoutput>

<cfelse>
0</cfif>


TOPICS
Advanced techniques

Views

246

Translate

Translate

Report

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 ,
Nov 12, 2006 Nov 12, 2006

Copy link to clipboard

Copied

Sorted. Got rid of the evaluate function and presto.

<cfif isdefined ("LeftOver#query.line#")>
<cfoutput>#Evaluate("LeftOver" & query.line)#</cfoutput>
<cfelse>
0</cfif>

"Sammy" <orders@seton.net.au> wrote in message
news:ej8bfc$9q8$1@forums.macromedia.com...
> I've created a dynamic variable without any problems. I now only want to
> display the variable if the variable exists or is defined. I've tried a
> few variations of the code below
>
> I cant seem to get the syntax correct. Can someone help me out?
>
>
> <cfif isdefined (Evaluate("LeftOver" & query.line))>
>
> <cfoutput>#Evaluate("LeftOver" & query.line)#</cfoutput>
>
> <cfelse>
> 0</cfif>
>


Votes

Translate

Translate

Report

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 ,
Nov 13, 2006 Nov 13, 2006

Copy link to clipboard

Copied

LATEST
> <cfoutput>#Evaluate("LeftOver" & query.line)#</cfoutput>

Avoid evaluate() if at all possible (which it usually is):

<cfoutput>#variables["LeftOver" & query.line]#</cfoutput>

--
Adam

Votes

Translate

Translate

Report

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
Documentation