cancel
Showing results for 
Search instead for 
Did you mean: 

Unique in multiple childs

manohar
Contributor

Hi there,

I have a schema like this

image

in which the data looks like below

image

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

1 ACCEPTED SOLUTION

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

View solution in original post

4 REPLIES 4

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.
image

Regards,
Viktor

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

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

Thank you very much @viktor_n . thats what I was looking for.

Thanks again,

Manohar