I'm wanting to pass json format file into a CDT and ultimately into data store using the Write to Datastore Smart Service.
What's the function I need to write as per below so that I can make this work ? Can't work out how to get from json into Dictionary or List format which seems to be required ?
Discussion posts and replies are publicly visible
stuartt0002 Can you explain the configuration you did here to push data into the database?
The basic answer is already there. What exactly are you looking for?
I'm a newcomer to the Appian platform, and I need guidance on uploading a .json file using a file upload component. The goal is to incorporate the file's data into the database. Here's a sample .json format:
{
"page.name" : "Home page", "page.nav.title" : "Appian community", "page.nav.button" : "Discuss"}
Could you provide a concise explanation on how can I go about achieving this task?
That's a nice challenge for a newcomer.
To be able to help you, I need to understand what you already learned. So, which of the following things do you already know?
- Store a uploaded file in a folder in Appian
- Create a record and store data to it
- Do all of the above in a process model
- Calling a record type constructor to create a new data structure
- Local variables in expressions
- Plugins
I did a similar challenge that involved importing Excel data into a database using a plugin (Excel Tools) and a smart service (“import excel to database”). I used concepts you mentioned, except for “- calling a record type constructor for creating a new data structure.”
OK. You need the plugin "Text File Utilities".
Then:
- Upload the file
- Then, in an expression with the uploaded file as a rule input
- load the JSON from the file (plugin function)
- convert it into an Appian dictionary using fromJSON()
- map the data to your record type (https://docs.appian.com/suite/help/23.4/reference-records.html#use-a-record-type-constructor)
- the record data is the output of the expression
- call this expression in a script task and store the output in a process variable.
- write the record
is this possible on nested Json structure?