OriginalPostID-231320
Discussion posts and replies are publicly visible
I think you need to provide a bit more context about what you're trying to achieve. You do not need to transform the JSON to a CDT unless you NEED that CDT for a specific purpose, and that's the bit we're missing from your description (e.g. if you want to store the data in a Database using Appian's Write to Datastore capability then, yes, a CDT will be required). If you just want to throw the data onto a User Interface you could just transform the JSON into a Dictionary - using a!fromJson() - and work with that natively...
Hi,
Based on my json script I want to create input fields such as text, integer, dropdown in interface by passing json values.
for eg. [{"filedname": "text"}, {"filedname": "integer"}] so it should create a text and an integer field based on whatever value I am passing in fieldname key
How I can achieve that?
First, create interface, just leave blank for now.
Make a!localVariables, make a local variable to save JSON data. Use the fromJson() to convert a JSON document you downloaded into a dictionary.
Now, create a text field, set it to read-only, set the value to the localVariable you made, local!jsonStorage or whatever you named it. Now your interface should be displaying the whole dictionary that came from your JSON.
Make a new text field, set it readOnly and set it's value to index(local!jsonStorage, "fieldOne", ""), now see output of that. Since you're starting out, it's going to be little by little, but soon you should have all the fields displaying the data from the JSON exactly how you want.
Then try to figure out how to get the users to edit them, then possibly cast that dictionary as a CDT. Maybe even use toJSON() to output json depending on your