Skip to main content
May 19, 2008
Question

Cfif isDefined questions

  • May 19, 2008
  • 1 reply
  • 377 views
Hello,

I need a little assistance with this, I'm trying to allow users to obtain a quote and when it no quote page, or/and give them a don't display quote page. Please help, Thank you

<cfif isDefined("#line_id#_Quote")>
No Quote

<cfelse>


DON'T display Quote"#line_id#_Quote#"

</cfif>
    This topic has been closed for replies.

    1 reply

    Inspiring
    May 19, 2008
    As far as I'm aware, you can't embed # tags within a variable name. For instance #list_#line_id#_value# will try to evaluate 'list_' and '_value' instead of 'line_id' and then its result. It's bad practice anyways.
    Instead, use arrays:

    Initializing:
    <cfset Quote=ArrayNew(1)>
    <cfset Quote[1]=...>
    <cfset Quote[2]=...>
    <!--- Note: CF arrays start at index 1, not 0 --->

    For your code:
    <cfif isDefined("Quote[#line_id#]")>
    <cfset output=Quote[#line_id#]>
    <cfelse>
    <cfset output="No Quote">
    </cfif>
    #output#
    May 19, 2008
    Thank you for the assist.