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

cfset error, help please

Guest
Nov 28, 2007 Nov 28, 2007

Copy link to clipboard

Copied

Why does this:

<cfsetting enablecfoutputonly="yes">
<CFSET TemplatesAndForms=application.menuWords."#session.MyLanguage#".TemplatesAndForms>
<cfsetting enablecfoutputonly="no">

produce this error

A CFML variable name cannot end with a "." character.
The variable application.menuWords. ends with a "." character. You must supply an additional structure key or delete the "." character.

and what do i need to do to fix.

many thanks

jedi
TOPICS
Advanced techniques

Views

591

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

correct answers 1 Correct answer

LEGEND , Nov 28, 2007 Nov 28, 2007
> Try like this,

> <cfsetting enablecfoutputonly="yes">
> <CFSET TemplatesAndForms=application.menuWords & ".#session.MyLanguage#." & TemplatesAndForms>
> <cfsetting enablecfoutputonly="no">

No, don't.

Do this:

<CFSET
TemplatesAndForms=application.menuWords[session.MyLanguage].TemplatesAndForms>

It might be useful to read this:
http://livedocs.adobe.com/coldfusion/8/htmldocs/arrayStruct_07.html#1126503

--
Adam

Votes

Translate

Translate
Advocate ,
Nov 28, 2007 Nov 28, 2007

Copy link to clipboard

Copied

Try like this,

<cfsetting enablecfoutputonly="yes">
<CFSET TemplatesAndForms=application.menuWords & ".#session.MyLanguage#." & TemplatesAndForms>
<cfsetting enablecfoutputonly="no">

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 28, 2007 Nov 28, 2007

Copy link to clipboard

Copied

> Try like this,

> <cfsetting enablecfoutputonly="yes">
> <CFSET TemplatesAndForms=application.menuWords & ".#session.MyLanguage#." & TemplatesAndForms>
> <cfsetting enablecfoutputonly="no">

No, don't.

Do this:

<CFSET
TemplatesAndForms=application.menuWords[session.MyLanguage].TemplatesAndForms>

It might be useful to read this:
http://livedocs.adobe.com/coldfusion/8/htmldocs/arrayStruct_07.html#1126503

--
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
Guest
Nov 28, 2007 Nov 28, 2007

Copy link to clipboard

Copied

LATEST
Thankyou for your reply Adam Cameron , it worked.

need to do some more reading up on structures :)

Thankyou

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
Guest
Nov 28, 2007 Nov 28, 2007

Copy link to clipboard

Copied

Hi Daverms,

Just tried your solution and get the following:

Complex object types cannot be converted to simple values.
The expression has requested a variable or an intermediate expression result as a simple value, however, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values.
The most likely cause of the error is that you are trying to use a complex value as a simple one. For example, you might be trying to use a query variable in a <CFIF> tag. This was possible in ColdFusion 2.0 but creates an error in later versions.


The error occurred in D:\cfmx\cfdev_working_folder\UKCHAPP40\dsp_LeftMenuModule.cfm: line 17

15 :
16 : <cfoutput>
17 : <cfset TemplatesAndForms=application.menuWords & ".#session.MyLanguage#." & TemplatesAndForms>
18 : </cfoutput>
19 :


any ideas?

matrix

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
Advocate ,
Nov 28, 2007 Nov 28, 2007

Copy link to clipboard

Copied

Hi Matrix,

I tested your code with some appliation and session variable assignments of my own and it worked well. But I am not sure if your #session.MyLanguage# variable is of complex type in nature or not.



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