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

IIF question

LEGEND ,
Sep 30, 2008 Sep 30, 2008
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?????


467
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 ,
Sep 30, 2008 Sep 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")#'
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 ,
Sep 30, 2008 Sep 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")#'
>


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 ,
Sep 30, 2008 Sep 30, 2008
you are also missing the closing ) for your iif function...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
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 ,
Sep 30, 2008 Sep 30, 2008
Hello Azadi,

It must be early, or I'm just dumb, but I don't see where its missing, I
see 3 opening ('s and 3 closing )'s........

> you are also missing the closing ) for your iif function...
>
> Azadi Saryev
> Sabai-dee.com
> http://www.sabai-dee.com/


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 ,
Sep 30, 2008 Sep 30, 2008
the one after 2008 should not be there, but before the last #...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
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 ,
Sep 30, 2008 Sep 30, 2008
LATEST
Hello Azadi,

Excellent help, thanks! That was the problem......

> the one after 2008 should not be there, but before the last #...
>
> Azadi Saryev
> Sabai-dee.com
> http://www.sabai-dee.com/


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