cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tugba
Helper I
Helper I

geting second data from listbox

I have 3 item in listbox. And i fill listbox from database with distinct and filter function. Now ı need to take second item in listbox.Is it possible to take second item in listbox?

1 ACCEPTED SOLUTION

Accepted Solutions
v-yuxima-msft
Community Support
Community Support

Hi @tugba 

 

Do you want to get the second item in the list box?

You can use this formula expression:Last(FirstN(datasource,2)).ColumnName

 

For example, 

DataSource:Customers

lastdatasource.PNG

 

ListBox2.Items=Customers.Name 

label8.Text=Last(FirstN(Customers.Name,2)).Name

last.PNG

 

 

More information:

function-first-last

 

 

Best Regards.

Yumia

View solution in original post

3 REPLIES 3
jhall
Continued Contributor
Continued Contributor

Do you mean a second DataSource (e.g. tblPeopleUS, tblPeopleCA) or do you mean a second value attached to the individual list items (e.g. tblPeople, tbleAddresses)?

Regardless, if any of this ever gets confusing, you can always create a Collection first before you need the List and then point the DataSource at the Collection.  So you could do whatever you need to do to build the Collection first just until you sort out the exact function formatting for a one-liner.

v-yuxima-msft
Community Support
Community Support

Hi @tugba 

 

Do you want to get the second item in the list box?

You can use this formula expression:Last(FirstN(datasource,2)).ColumnName

 

For example, 

DataSource:Customers

lastdatasource.PNG

 

ListBox2.Items=Customers.Name 

label8.Text=Last(FirstN(Customers.Name,2)).Name

last.PNG

 

 

More information:

function-first-last

 

 

Best Regards.

Yumia

View solution in original post

Thank you.It is working:)


@v-yuxima-msft wrote:

Hi @tugba 

 

Do you want to get the second item in the list box?

You can use this formula expression:Last(FirstN(datasource,2)).ColumnName

 

For example, 

DataSource:Customers

lastdatasource.PNG

 

ListBox2.Items=Customers.Name 

label8.Text=Last(FirstN(Customers.Name,2)).Name

last.PNG

 

 

More information:

function-first-last

 

 

Best Regards.

Yumia


 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,557)