I have been playing with an external api in codeless and have been succesfull in getting data and storing it in my table.
I have created a second table in relation to the first. I have a array from the external api that i want to store in the relational table. Each item in the array needs its own entry in the table.
How could i achieve this? Or is it not possible perhaps?
In the json i get from the api there is 1 property that is an array. The other properties in the json are either string value, date, image. I need a way to deconstruct the array. So that the string values that are stored in the array can all get their own entry in the second table.
I got close but it got stored as a single entry in the table.
If i can deconstruct the array, i can then reuse the seperate value’s.
Could you please show what you came up with? Also please attach a screenshot of your table schema (from the Visual Modeler tab in backendless console). It will help in understanding what you’re trying to do.
This is my codeless logic. Everything works except for the add object relations. What i have now is wrong, i’ve been testing all kind of things looking through older threads on the support forum.
The genres relationship column is declared in the Movie table. But in your code, you’re updating the relationship in the Genre table, that is wrong:
Also, the Deep Save block, will create all the relationships for you automatically. You should be able to pass the genres property in Deep Save with the corresponding values and the related objects will be created.
Important: The related collection must be a list of objects. If it is a list of strings, it will not work.
This is what I referred to when in my “important” note in the previous message.
To save the genre elements as individual records, you need to transform the list of strings into a list of objects. Here’s a video about list transformations from our latest training course: