how to read the value of a data field so that i can hide and show other fields based on values of data field?
for example: i have a data field mapped to City. The values is returned from groovy by DDS call. if i have 2 city names in data field, i want to display a dropdown and if 1 city name returned from DDS, want to display in text field.
If your data field contains JSON data then you can use JSON.parse to convert to object.
Thanks Ben, this will help, will give try
If you use the Maestro DynamicData.call() API function in a rule, like a field change or page load, you can assign the response to a single data field like this:
Because Maestro understands the nature of the Dynamic Data Service call, it automatically serializes the response from Transact Manager into an object. This is particularly useful for complex structures with nested hierarchies and arrays.
Next, in the Show If... visibility rules for the target fields, the text field and the dropdown list in your case, you simply add a test for the array of returned cities:
Here I'm assuming that the data that came back from Transaction Manager looks like:
One feature that I really like, is the ability to mock up data in Maestro, by simply returning the data I expect from the calculation rule of my response data field. This allows me to continue developing, or build a model that I expect from the Dynamic Data call.
You should read Ben's Advanced Debugging of Maestro Forms to guide your development.
Thanks Jason, this example is a great one.
However implementing this my form throws multiple unknown error on page load, because by that time the DDS is not called
You raise a good point. In my examples, there should be guards around the use of the data.response fields in the dropdown and textbox Show If... rules.
In the script editor for your visibility rule you can double click the data field in the heirachy to add its value to your logic.
Sorry Ben,I think I couldnt address my requirement properly.
my Data Field contain 2 cities(json result retun from DDS) say, [San Diego] [San Jose]
How can I read these values of 'data field' so i cant count 2 ?