How to get the read data result value with chrono syntax?

Access specific field values from a CF read data result.

Overview

The issue occurs when using incorrect syntax to target a specific field within a data array returned by the read data function.
Ensure the Select Type is set to 'first matching' for a single record, then use the syntax {var:read_data9.content.title} without brackets or index numbers to output the field value.

Answered
ChronoForms v6
ca cambium 19 Jan, 2019
Hi here!
I have the read data function on my form and trying to get the results from data array.
If i use
{var:read_data9}
it works and i get the complete array, but if i use
{var:read_data9.content.title}
i get nothing.
Why i get no result using this chrono syntax command?

How to get the read data result value with chrono syntax? image 1
he healyhatman 20 Jan, 2019
Answer
1 Likes
If you're trying to get one record only, you need to set Select Type to first matching. Otherwise you need {var:read_data9.number_of_the_record_you_want.model.field}
ca cambium 20 Jan, 2019
I tried with
{var:read_data9.[0].content.title}
too, but it not works (select type shifting not help).
But i get the array with current settings.
With {var:read_data9} i get:
[{"content":{"title":"Galactosemia","alias":"galactosemia"}}]
I get the right one record with two fields (title and alias), but need to output them separately from each other.
And i don't know how do it
he healyhatman 20 Jan, 2019
read_data9.0 , without the square brackets. But again you shouldn't be using the number because it seems you should be selecting just one record.

So {var:read_data9.content.title}
ca cambium 20 Jan, 2019
It works, indeed.
Earlier didn't work because i tried to use this chrono syntax command into wrong place.
This topic is locked and no more replies can be posted.