cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mob
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
Meneghino
Community Champion
Community Champion

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
Meneghino
Community Champion
Community Champion

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))

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!

Meneghino
Community Champion
Community Champion

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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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