Skip to main content
Inspiring
September 30, 2008
Question

IIF question

  • September 30, 2008
  • 6 replies
  • 471 views
I'm experimenting with a IIF to choose with file gets used with <cffile>.
I have:

<cffile action="read" file="#iif(xmlFileYear eq 2008),de("D:\home\salleboise.com\wwwroot\sb1.xml"),de("D:\home\salleboise.com\wwwroot\sb2009.xml")#"
variable="xmldoc">

but when I run the code, I'm getting:

Invalid CFML construct found on line 192 at column 54.
ColdFusion was looking at the following text:
,

The CFML compiler was processing:

An expression that began on line 192, column 29.
The expression might be missing an ending #, for example, #expr instead of
#expr#.
The tag attribute file, on line 192, column 23.
A cffile tag beginning on line 192, column 2.

Did I miss something?????


    This topic has been closed for replies.

    6 replies

    Inspiring
    September 30, 2008
    steve grosz wrote:
    >
    > Did I miss something?????
    >
    >

    Yup... You can not combine the same double quotes like you did... CF
    does not know when one set starts and another set ends. When nesting
    quotes as you need to in this function, you need to mix single and
    double. Either way is fine.


    file="#iif(xmlFileYear eq
    2008),de('D:\home\salleboise.com\wwwroot\sb1.xml'),de('D:\home\salleboise.com\wwwroot\sb2009.xml')#"

    OR

    file='#iif(xmlFileYear eq
    2008),de("D:\home\salleboise.com\wwwroot\sb1.xml"),de("D:\home\salleboise.com\wwwroot\sb2009.xml")#'
    Inspiring
    September 30, 2008
    Hello Ian,

    Hmmmm, well, I changed it to:

    <cffile action="read" file="#iif(xmlFileYear eq 2008),de('D:\home\salleboise.com\wwwroot\sb1.xml'),de('D:\home\salleboise.com\wwwroot\sb2009.xml')#"
    variable="xmldoc">

    and I'm still getting:

    Invalid CFML construct found on line 192 at column 54.
    ColdFusion was looking at the following text:
    ,

    The CFML compiler was processing:

    An expression that began on line 192, column 29.
    The expression might be missing an ending #, for example, #expr instead of
    #expr#.
    The tag attribute file, on line 192, column 23.
    A cffile tag beginning on line 192, column 2.



    > steve grosz wrote:
    >
    >> Did I miss something?????
    >>
    > Yup... You can not combine the same double quotes like you did... CF
    > does not know when one set starts and another set ends. When nesting
    > quotes as you need to in this function, you need to mix single and
    > double. Either way is fine.
    >
    > file="#iif(xmlFileYear eq
    > 2008),de('D:\home\salleboise.com\wwwroot\sb1.xml'),de('D:\home\sallebo
    > ise.com\wwwroot\sb2009.xml')#"
    >
    > OR
    >
    > file='#iif(xmlFileYear eq
    > 2008),de("D:\home\salleboise.com\wwwroot\sb1.xml"),de("D:\home\sallebo
    > ise.com\wwwroot\sb2009.xml")#'
    >