5 Replies Latest reply on Nov 28, 2007 6:21 AM by Matrix16

    cfset error, help please

    Matrix16
      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
        • 1. Re: cfset error, help please
          Daverms Level 3
          Try like this,

          <cfsetting enablecfoutputonly="yes">
          <CFSET TemplatesAndForms=application.menuWords & ".#session.MyLanguage#." & TemplatesAndForms>
          <cfsetting enablecfoutputonly="no">
          • 2. Re: cfset error, help please
            Level 7
            > 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
            • 3. cfset error, help please
              Matrix16 Level 1
              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
              • 4. Re: cfset error, help please
                Daverms Level 3
                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.



                • 5. cfset error, help please
                  Matrix16 Level 1
                  Thankyou for your reply Adam Cameron , it worked.

                  need to do some more reading up on structures :)

                  Thankyou