2 Replies Latest reply: Oct 21, 2012 1:32 AM by Aaron Neff RSS

    Creating structures

    Community Help Community Member
        • 1. Re:  Creating structures
          CF-AXL Community Member

          These are valid statements.

          <cfset myStruct = {structKey1 = {innerStructKey1 = "innerStructValue1"}}>

          <cfset myStruct={structKey1.innerStructKey1 = "innerStructValue1"}>

           

          A closing angle bracket (>) is missing in

          <cfset innerStruct1 = {innerStructKey1 = "innerStructValue1"}

           

          An extra quotation in front of "Adobe Systems Incorporated" in

          <cfset "#i#"={name = ""Adobe Systems Incorporated"}>

           

          This is also a valid statement.

          <cfset "#i#"={name = "Adobe Systems Incorporated"}>

          • 2. Re:  Creating structures
            Charlie Arehart CommunityMVP

            This section should be updated to reflect the new support for colon ( notation for defining structure keys as key:value pairs.

             

            So for the example above showing:

             

             

             

            that could now be done in CF10 as:

             

            <cfset coInfo=>

             

            (BTW, the example which I've quoted is actually missing a closing bracket in the text above.)

            • 3. Re:  Creating structures
              Charlie Arehart CommunityMVP

              Ugg: it seems that the editor used for comments here does not permit use of tags. That's really lamentable.

               

              I will repeat here the two lines of code I was offering, without any brackets this time:

               

              Old way:

              cfset coInfo={name="Adobe Systems Incorporated", industry="software"}

               

              New way:

              cfset coInfo=

               

              (BTW, it's curious that while the first line disappeared entirely when my first comment is displayed, the second line appears partially. So it's not really that ALL tag using brackets disappears, but all of some lines, and some of other lines. Either way, it would be helpful if this web page editor, used for entering comments on a tag-based language like CFML, was able to handle displaying any code entered here.)

              • 4. Re:  Creating structures
                Charlie Arehart CommunityMVP

                Wow, even colons seem to cause problems, so that the "new way" line still is botched. Put it this way, reader: you can replace the = within the curly braces with a colon (:). It seems that the editor doesn't like when a colon is used with curly braces. Go figure!

                • 5. Re:  Creating structures
                  Aaron Neff CommunityMVP

                  Hi Charlie,

                   

                  I learned by chance that we can find our post in the forums, then edit the post, and fix the brackets there.  That particular edit box doesn't have this issue.

                   

                  I agree that the comment box on the docs pages is frustrating.  I wish Adobe would fix it.

                   

                  Thanks,

                  -Aaron