cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Is it possible to select specific item from an array or collection? (with the help of index)

I have for example this:

First ( First( First(allData).input ).myData ).Value

 

and I get 10 items which is totally fine. But I would like to select just the 5th item , how can I do it?

I tried something like this

First ( First( First(allData).input ).myData ).Value[4] or so but does not work....

 

any help? Is it possible this  what I am trying?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Is it possible to select specific item from an array or collection? (with the help of index)

To select the 5th item of MyTable then use:

Last(FirstN(MyTable, 5))

 

This means that you probably need:

Last(FirstN( First( First(allData).input ).myData , 5))

View solution in original post

3 REPLIES 3
Highlighted
Community Champion
Community Champion

Re: Is it possible to select specific item from an array or collection? (with the help of index)

To select the 5th item of MyTable then use:

Last(FirstN(MyTable, 5))

 

This means that you probably need:

Last(FirstN( First( First(allData).input ).myData , 5))

View solution in original post

Highlighted
Advocate II
Advocate II

Re: Is it possible to select specific item from an array or collection? (with the help of index)

tnx!!  it works, but it's kind of hack... i mean there is no solution to "declare index of items" e.g.[4].

 

here you select 1,2,3,4,5 and then last which is 5

 

anyway tnx, it works perfectly!

Highlighted
Community Champion
Community Champion

Re: Is it possible to select specific item from an array or collection? (with the help of index)

You are welcome.  Yes, it is kind of a hack and also be careful because if there are less than 5 items then you will probably be returned the last in any case.  So you may need an If(CountRows(MyTable)>=5, ) to wrap around your statement.

 

I have learned quite a few hacks for PowerApps over the last couple of months...

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (6,596)