cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
D_Izani
Regular Visitor

Filter Gallery from SharePoint

Hello,

 

I’m new to building PowerApps and programming. So, I hope there is a patient person there who can help me with applying a filter to my gallery.

 

My app is created against the SharePoint list.

 

1. What I plan is when the user click the button, it will bring them to the list that has been submitted by the user.

D_Izani_0-1658642895054.png

 

2. Here is my form, the user can choose the category but I don't know how to make it the submission will be directly saved in the specific category button.

D_Izani_1-1658643073266.png

 

3. My SharePoint

D_Izani_2-1658643227631.png

 

 

I try to use this coding on the gallery but the list will not come out:

Sort(
       Filter(
            'Inventory Management',
             Category = "Office"
          )         
)

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @SBax ,

Firstly @SBax has done all the work here, so please accept his efforts. You have two problems, both stemming from the Choice column. Firstly (the easy bit), you need .Value after the reference as a Choice column is a complex field type (a Table with one column called Value). The second bigger issue with using these columns (unless you have to) is you cannot sort by them in a Delegable manner. The below will work

Sort(
   AddColumns(
      Filter(
         'Inventory Management',
         Category.Value = "Office"
      ),
      "Cat",
      Category.Value
   ),
   Cat
)

 

I have a blog on field types that may interest you.

View solution in original post

12 REPLIES 12
SBax
Impactful Individual
Impactful Individual

Your filter part is correct but you haven't entered a column to sort by

 

Example syntax:

 

Sort'(Ice Cream' flavour)

 

ice cream is your data and flavour is the column you are sorting by.

 

 So you need something like

 

Sort(Filter(

            'Inventory Management',
             Category = "Office"
          ), *Insert name of column you want to sort by here*)

Thank you for your reply, I have tried your solution word for word but it didn't work.

 

1. There was an error in the Sort function

D_Izani_0-1658654363062.png

 

2. Is this related to my column format as I set it as a choice, not a single-line text?

D_Izani_1-1658654475211.png

 

Hope you can help me. Thank you!

 

SBax
Impactful Individual
Impactful Individual

Hi,

 

Sorry, I assumed it was a text field

 

For choice columns, you need to add ".text"

 

Sort(

Filter(

 

            'Inventory Management',

             Category.text = "Office"

          ),

Category)

 

 

I literally followed your solution but it still did not work.

 

D_Izani_0-1658655734786.png

 

It said that "text" isn't recognized, Does I need to set "text" somewhere in the gallery?

SBax
Impactful Individual
Impactful Individual

@D_Izani Apologies, I'm mixing up JavaScript and Power FX try .value in place of the .text

 

If this does not work, please share the eroor

Alright, let me share the errors:

 

1.

D_Izani_0-1658657028902.png

 

2. 

D_Izani_1-1658657054336.png

3.

D_Izani_2-1658657075979.png

 

4.

D_Izani_3-1658657098088.png

It would be really helpful if you could help me to solve the errors. Thank you!

SBax
Impactful Individual
Impactful Individual

I've just got to pop out for the afternoon, but will jump onto my laptop when I get home and attempt to replicate this 

Alright, thank you and hope to hear from you soon.

SBax
Impactful Individual
Impactful Individual

Quick question, is company a choice column or plain text?

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,034)