Posting into an array via API

Options

Hi,

I'm currently working with an post API call, which I would like to post into an array with each row being separate.

I have my db set up with an field called Risk_1 (type: object/Structure: single). Within this I then have two fields "What could go wrong" and "Who is at risk" (type: text/ Structure: list).

I've tried using the set and push filter which will post the entries but for each entry I'd like them to be on a new line. I thought I'd be able to use the split filter and separate them that way but this causes an error.

Any super brilliant help would be we received as I'm clearly missing something

Tagged:

Answers

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Hi,

    I'm not sure if I fully understand. Can you show your functions stack? Specifically, the place function that throws an error?

  • MW1986
    MW1986 Member
    Options

    Hi, Thanks for the reply.

    I've attached the function stack.

    What I want to achieve is for each item submitted for the inputs "What_could_go_wrong" and "Who_is_at_risk" a new line is generated in the sub item under Risk_1. When I post to it I get the result in the 1st image. But what I'd like to have happen is result in the 2nd image.

    If I try to add the split filter as below:

    I get this error:

    I'm missing something obvious I'm sure

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Hi,

    You are already sending a list as an input, split filter is used to split a single string into an array, that's why are you having an error.


    What you can do is to count elements in the lists (if they are always equal the better) and create a for loop with iterations equal to the numbet of elements in a longer list, before the loop create an empty array and inside the loop create an object variable for every iteration and append it to empty list, finally save finished list in your record.