cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
madmvx
Frequent Visitor

Remove item from a Array

Hello, i need some help i need to dynamically delete items from some arrays

My arrays are like this:

 

[
[1,2,3],[1,2,332],[1,22,113],[1,223,323]
]

And 

First: I need to calculate the quantity of items so, exist a function like: quantity(myArray)

Second: I need to delete some items of my array,  example: like the 3 first items

[
[1,223,323]
]

And get something like this

 

How can i do this?

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-LilyW-msft
Community Support
Community Support

Hi @madmvx 

Thank you for posting.

You can use the ‘length’ and ‘skip’ function to get the array you want.

Please refer to the screenshot as below:

v-LilyW-msft_0-1621479965756.png

You can use ‘Length’ function to return the number of items in the array.

Expression:length(variables('myArray'))

v-LilyW-msft_1-1621479965760.png

Than you can use ‘skip’ function to remove items from the front of a collection, and return all the other items.

Expression:skip(variables('myArray'),add(outputs('Compose_2'),-1))

v-LilyW-msft_2-1621479965762.png

After the flow runs,you will get the array as below:

v-LilyW-msft_3-1621479965764.png

 

For more info about functions you can refer to this document.

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference

 

Hope the content above may help you.

Best Regards

Lily

View solution in original post

2 REPLIES 2
v-LilyW-msft
Community Support
Community Support

Hi @madmvx 

Thank you for posting.

You can use the ‘length’ and ‘skip’ function to get the array you want.

Please refer to the screenshot as below:

v-LilyW-msft_0-1621479965756.png

You can use ‘Length’ function to return the number of items in the array.

Expression:length(variables('myArray'))

v-LilyW-msft_1-1621479965760.png

Than you can use ‘skip’ function to remove items from the front of a collection, and return all the other items.

Expression:skip(variables('myArray'),add(outputs('Compose_2'),-1))

v-LilyW-msft_2-1621479965762.png

After the flow runs,you will get the array as below:

v-LilyW-msft_3-1621479965764.png

 

For more info about functions you can refer to this document.

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference

 

Hope the content above may help you.

Best Regards

Lily

Thanks, this works very well

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

AI Builder AMA June 7th carousel (up on May 25th, take down June 8th) (1).png

'Ask Microsoft Anything' about AI Builder!

The AI Builder team invite you to ask questions and provide helpful answers at our next AMA.

Users online (1,974)