cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pNabin
Level 8

Get Nth Item from the result of Split function

Hi,

I have to get the 5th & 6th item splitted by '/' in an URL (like : "https://hello.com/sites/customer/portal/details") which is customer & portal.
I have used the split function and stored it in collection with one Column (Result).

ClearCollect(colSplittedURL,Split(TextInputURL.Text,"/"))

How can I get Nth (5th & 6th) item from collection colSplittedURL?

 I know First(colSplittedURL) gives the first item and Last(colSplittedURL) gives the last item of the collection but I don't know how to get soemthing in the middle.

 

Thanks,

Nabin

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Get Nth Item from the result of Split function

You can use a combination of the FirstN and Last functions to access an item at a specific index. To get the 5th element from your collection you'd use

Last(FirstN(colSplittedUrl, 5))

And similarly for the 6th element:

Last(FirstN(colSplittedUrl, 6))

Hope this helps!

View solution in original post

1 REPLY 1
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Get Nth Item from the result of Split function

You can use a combination of the FirstN and Last functions to access an item at a specific index. To get the 5th element from your collection you'd use

Last(FirstN(colSplittedUrl, 5))

And similarly for the 6th element:

Last(FirstN(colSplittedUrl, 6))

Hope this helps!

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,676)