coldfusion - Dealing with WhiteSpaces while accessing Structure "keys" -


please consider following image: enter image description here

so, how correctly access "android phone" key in structure. when following(an excerpt code):

<cfloop from="1" to="#arraylen#" index="i">           <cfif structkeyexists(cfdata[i], "open")>         <cfoutput>#cfdata[i].open.aol#</cfoutput>        <cfelse>          null       </cfif>      </cfloop> 

it works fine, however, when try <cfoutput> following :

<cfoutput>#cfdata[i].open.android phone#</cfoutput> 

or

<cfoutput>#cfdata[i].open.androidphone#</cfoutput> 

i following error:

element open.androidphone undefined in cfml structure referenced part of expression.

the error occurred in c:myfile.cfm: line 185

183 :         <!--- <cfloop list="#keylist#" index="colitem"> --->     184 :         <cfif structkeyexists(cfdata[i], "open")> 185 :         <cfoutput>#cfdata[i].open.androidphone#</cfoutput> 186 :          187 :       <cfelse> 

question #2: encountering 1 more weird phenomenon:

when outputtin values following:

<cfoutput>#cfdata[i]["open"]["android phone"]#</cfoutput> 

and

 <cfoutput>#cfdata[i]["open"]["android tablet"]#</cfoutput> 

it works fine.

however, when change following:

<cfoutput>#cfdata[i]["open"]["lotus notes"]#</cfoutput> 

i getting following error:

element lotus notes undefined in cfml structure referenced part of expression.

the error occurred in c:myfile.cfm: line 185  183 :              184 :         <cfif structkeyexists(cfdata[i], "open")> 185 :         <cfoutput>#cfdata[i]["open"]["lotus notes"]#</cfoutput> 186 :          187 :       <cfelse> 

is works series of space related keys , not 1 occur after single words keys? please advise.

in case because of space can't use dot notation must use bracket-quote notation:

<cfoutput>#cfdata[i]["open"]["android phone"]#</cfoutput> 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -