1b.app
Link copied -

Writing a full array to a field (API)

Based on the task https://1b.app/ru/forum/business-processes-and-automation/17359-zapis-answer-iz-...
Here https://univer.1b.app/admin/shop/workflowstatus/707/action/new/
You need to get the entire array in the field, if the selected value is an array, for example:
{"result":[{"name": "one", "old": "33", "date": "20.04.1980}, {"name": "two", "old": "20", "date": "12.07.2003},{"name": "three", "old": "25", "date": "10.06.1998}]}
then I will specify in the action "Pass the process to the API" the processing of the value "/result" and the entry in the field should be like this:
name: one, old: 33, date: 04/20/1980; name: two, old: 20, date: 07/12/2003; name: three, old: 25, date: 06/10/1998.
That is, we remove the quotes in the key and value and write each object through a semicolon, and put a dot at the end of the last element of the array.
If it's an array and it's empty, then the value of the field should be "empty".
How many hours do you need to implement?
Original question is available on version: ru

Answers:


Pyatetsky Nikolai Nikolaevich
OneBox Insiders wrote:
name: one, old: 33, date: 04/20/1980; name: two, old: 20, date: 07/12/2003; name: three, old: 25, date: 06/10/1998.

looks like some kind of hard crutch. Why do you need it at all? Why can't you simply shove it all across the fields?
13.07.2023, 14:17
Original comment available on version: ru


Care Department
OneBox production wrote:

Pyatetsky Nikolai Nikolaevich
OneBox Insiders wrote:
name: one, old: 33, date: 04/20/1980; name: two, old: 20, date: 07/12/2003; name: three, old: 25, date: 06/10/1998.

looks like some kind of hard crutch. Why do you need it at all? Why can't you simply shove it all across the fields?

The array has 20 elements conditionally. In general, there may be an unknown quantity. How else do you propose to shove them?
This is not a crutch, but simply pulling general information from an array through a separator.
As an option, there could be some kind of ultra field of an array of objects, but then you need to finish a bunch of everything besides the field (templates, variables, etc.).
Alternatively, it may be a cool solution to pull the data into the directory as an array of objects, this option would probably solve some requirements.
And so, it is necessary purely to check the info on the client.
13.07.2023, 14:23
Original comment available on version: ru


we make a setting in which we set the separator. If the separator is set, then we write an array in the additional field, if not, then we write the word empty or any other specified in the settings .3h
13.07.2023, 15:04
Original comment available on version: ru


The work has been uploaded.
Setting "Enter a separator for array elements"
16.08.2023, 18:10
Original comment available on version: ru

Please join the conversation. If you have something to say - please write a comment. You will need a mobile phone and an SMS code for identification to enter. Log in and comment