cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Collonville
Frequent Visitor

Filter items in dropdown list from sharepoint

I want to filter drop-down list items are referenced by share point.

Specifically, there is are items in share point list like this ["A", "B", "C", "D", "E"].
Then in App1, I want to get top 2 items ["A", "B"] from a list, and App2 wants to get until third lower place ["C", "D", "E"].

 

I used FirstN and LastN property, but it didn`t get a result.

Are there any way to solve this problem??

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Hi @Collonville,

 

use the FirstN function this way:

FirstN(Choices('your_list.Testlist'), 5)

I guess this will only be possible in a form which generates the fields.

 

 

View solution in original post

7 REPLIES 7
Andy_Tuke
Resolver IV
Resolver IV

Hi,

 

FirstN (and LastN) should work fine.  I assume you are trying to filter a Gallery to only show the required items from the SharePoint list?

 

I have created a list in SharePoint and added 5 items where the title is set to A,B,C,D,E

I created a blank app and add a datasource to that list

I inserted a gallery, linked to that datasource with 1 fields showing which I set to the Title column of the SharePoint list.  My gallery now shows all the items in the list

To filter to the first 2 items I set the Items parameter of the Gallery to FirstN(DemoList,2)

 

At this point, the gallery goes blank.  This is because when you change parameters on the gallery it resets the column that it is showing to the default, and useless ComplianceAssetId which is a built in SharePoint list column.  You can set it back in the gallery Data panel to Title again to fix it.  You will find that if you keep editing the gallery you will need to fix it again.  To stop this behaviour so it stays on the column you want change the Text parameter of the label in the gallery from ThisItem.Title to Title

 

Hope that helps, let me know if it doesnt.  I sense English isn't your first language and I might have misunderstood your issue

Andy

Anonymous
Not applicable

Hi @Collonville,

 

can you provide your function and a screenshot of your Sharepoint list? How do you receive your data?

Anonymous
Not applicable

Are you sure the gallery isnt resetting the controls for the selected items back to something like ThisItem.ComplianceAssetId when you change the items parameter?  For some reason, whenever you change properties of a gallery it does this, the simplest fix is to remove the ThisItem prefix once you've chosen the column you want to display

SanchezCSG
Resolver I
Resolver I

Try this

 

Sharepoint list name= List1

Column name= Column1

 

Column1 "Items" = One, Two, Three, Four, Five

 

App1 -Dropdown1 Items = Filter(List1;Column1="One" || Column1="Two")

 

App2 -Dropdown2 Items = Filter(List1;Column1="Three" || Column1="Four" || Column1="Five")

 

Collonville
Frequent Visitor

@SanchezCSG @Anonymous @Anonymous @Andy_Tuke

Thanks for your reply.

The list data what I`m assuming is the choice option of Share point like left figure(Sorry for the Japanese language).
Then, I want to show only ["A", B"] choice in App1, ["C", "D", "E"] choice in App2 list using a drop down on the edit form. Usually, it will show drop down list like right figure. So I want to display separately while referring to the same share point.

SharepointList.JPG

 

 

 

 

 

SharepointList2.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Default Item property on  Power apps shows like this.SharepointList3.JPG

 

 

I tried FirstN(***.TestList, 2) or Filter function but I had an error. 

Anonymous
Not applicable

Hi @Collonville,

 

use the FirstN function this way:

FirstN(Choices('your_list.Testlist'), 5)

I guess this will only be possible in a form which generates the fields.

 

 

Thank you!! It worked well.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

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