Copy link to clipboard
Copied
This is my current and outer cfloop. How many nested cfloops do I need to get to data.current_version.en.text field? My guess is two loops but I'm not sure about specifying the value for the "to" in the cfloop.
<cfif structKeyExists(cfData, 'data')>
<cfoutput>
<cfloop index="i" from ="1" to="#arrayLen(cfData.data)#">
<h1>#cfData.data.searchTitle.en#</h1>
<p>#cfData.data.current_version.en.text#</p>
</cfloop>
</cfoutput>
</cfif>
And this is what the struct looks like.
1 Correct answer
Okay, got it work.
<cfif structKeyExists(cfData, 'data')>
<cfoutput>
<cfloop index="i" from ="1" to="#arrayLen(cfData.data)#">
<h1>#cfData.data.name#</h1>
<p>#cfData.data.current_version.en.text#</p>
</cfloop>
</cfoutput>
</cfif>
Copy link to clipboard
Copied
Okay, got it work.
<cfif structKeyExists(cfData, 'data')>
<cfoutput>
<cfloop index="i" from ="1" to="#arrayLen(cfData.data)#">
<h1>#cfData.data.name#</h1>
<p>#cfData.data.current_version.en.text#</p>
</cfloop>
</cfoutput>
</cfif>

