Forum Discussion

manohar's avatar
manohar
Contributor
3 years ago
Solved

Unique in multiple childs

Hi there,

I have a schema like this

in which the data looks like below

Basically, I am making an API call to insert order Line, and as they are getting inserted, the response result is bringing back the records.

starts with 1 then based on the number on the number of requests, the response brings back all the inserted ones, repeating previously inserted ones.

respose1
{
1
}
respose2
{
1,
2
}
respose3
{
1,
2,
3
}

my goal is to get distinct inserted records

as
Order-Lines : [
{
1,
2,
3
}
]

please find here the sample input for more understanding.

any guidance is greatly appreciated.

Thanks
Manohar

  • Hi @manohar,

    Here is an updated pipeline.
    Community_2022_12_04.slp (1.7 MB)

    I’ve made two samples. First one is with the all other data included from the response and second one is only with order lines. See which will work for you more.

    If it’s still something as you not expect tell me I am here to help.

    Regards,
    Viktor

4 Replies

  • viktor_n's avatar
    viktor_n
    Contributor II

    Hi @manohar

    There are several ways from which you can get the correct order line. Here are two of them.

    1. $['order-line'][$['order-line'].length-1]
    2. $['order-line'].pop()

    You can always pull out last element of the array.

    Regards,
    Viktor

    • manohar's avatar
      manohar
      Contributor

      Thanks @viktor_n for the direction.

      I have tried multiple ways but did not see how to get it. please see attached pipeline that I have tried.

      Community_2022_12_04.slp (877.8 KB)

      please advice what I am missing.

      Thanks
      Manohar

      • viktor_n's avatar
        viktor_n
        Contributor II

        Hi @manohar,

        Here is an updated pipeline.
        Community_2022_12_04.slp (1.7 MB)

        I’ve made two samples. First one is with the all other data included from the response and second one is only with order lines. See which will work for you more.

        If it’s still something as you not expect tell me I am here to help.

        Regards,
        Viktor