DC Looper API - How to access value from key that has dot syntax

As you can see from the screenshot - I’m trying to access the value for the key “Courses_Serial_Number”, but the issue is that it’s under the parent key “Courses” using a dot (.) (Courses.Course_Serial_Number)

I know this works if the Course Serial is a key when its in an Object, and using dot(.) will help with accessing those keys in the Object. But how do I access when the key is like this?

Hello @bobbyninetoes,

Thanks for posting in!

You can use the Looperdepth property. Something like {{dc:looper:field key="Courses.Courses.Course_Serial_Number" depth="1".

We would love to check your Looper settings to fully investigate the issue. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
– Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

image

Cheers.

Hi,

Unfortunately that didn’t work - I think the depth only works for normal keys with no dots (.)
See example below:

Works:
{{dc:looper:field key=“Courses.Course_Serial_Number” }}
or {{dc:looper:field key=“Courses.Course_Serial_Number” depth=“0” }}

“Courses”: {
“Course_Name”: “Course Name”,
“ID”: “118644000003209497”,
“zc_display_value”: “Course Name”;
“Course_Serial_Number”: “1153”
},
“ID”: “118644000004210484”,
“Start_Date”: “02 July 2024 09:30”,
“End_Date”: “02 July 2024 16:30”,

DOES NOT WORK
{{dc:looper:field key=“Courses.Course_Serial_Number” depth=“1”}}

“Courses”: {
“Course_Name”: “Course Name”,
“ID”: “118644000003209497”,
“zc_display_value”: “Course Name”;
},
“ID”: “118644000004210484”,
“Start_Date”: “02 July 2024 09:30”,
“End_Date”: “02 July 2024 16:30”,
“Courses.Course_Serial_Number”: “1153”

As you can see, getting the value in keys that has dot(.) doesn’t work even when you use whatever number of depths. But it works for normal keys(objects)

The test page is a Draft page with a title API Test

You currently can’t grab a looper field if it has a dot in it’s key. Cornerstone expects the dot to mean you are grabbing inside an object (as in { "Courses": { "Course_Serial_Number": "1153" } }). We can get this updated so you can grab this in another release. If you can control the data and put the Course_Serial_number inside the Courses object, you could also fix this issue from that. Or remove the . from the key. Since you mentioned API you probably can’t, but we’ll get this updated sometime in Pro 6.5. Have a great day.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.