cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CommanderKeen
New Member

Take only the first x number of items in array

I have an array containing 200.000 items (lines from a CSV file). I want to select only the first 100.000 items in the array or split the array into multiple arrays. In LogicApps there is a "take"-function but this doesn´t seem to work in PowerAutomate. I have looked into the "filter array"-syntax but I can´t figure out how to filter on the item count/index (e.g. "give me items 10-100") - there is nothing in the content that I can split/filter on.

 

If this is just not possible.. Could I somehow split the string (before it gets converted to an array) on a specific line number?

 

Hope someone has a creative suggestion! Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
efialttes
Super User
Super User

Hi!

"In LogicApps there is a "take"-function but this doesn´t seem to work in PowerAutomate."

 

You mean you already tried to apply a take() based expression in in your flow, and it throws an error due to some sort of reaching a limit below 200.000, right?

And also assume there is not any index column in your csv file, right?

 

Thanx!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

4 REPLIES 4
efialttes
Super User
Super User

Hi!

"In LogicApps there is a "take"-function but this doesn´t seem to work in PowerAutomate."

 

You mean you already tried to apply a take() based expression in in your flow, and it throws an error due to some sort of reaching a limit below 200.000, right?

And also assume there is not any index column in your csv file, right?

 

Thanx!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Hi I just tried again using take-function (to document the error) but to my surprise it actually worked(!!). Something else must have been wrong when I tried earlier and I was too quick to conclude that the expression was not supported.

 

What I did: I created a Compose-action and used expression: "take(outputs('NAME_OF_MY_ARRAY'),3)" and the output consisted of just the first 3 items as I wanted.

 

Thank you for answering though!

Hi!

Well, I must confess I am also surprised it could deal 200,000 elements.

Thanx for taking the time to mark this topic as solved! THis way other community membersfacing this same challenge in the future will find faster the solution.

You guys make this community great!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



This worked! take() is my new favourite function. Thank you! 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (1,379)