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!

View solution in original post

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!

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 314 members 6,095 guests
Please welcome our newest community members: