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
PowerApps Staff CarlosFigueira
PowerApps 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!

1 REPLY 1
PowerApps Staff CarlosFigueira
PowerApps 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!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 52 members 4,762 guests
Please welcome our newest community members: