Hi, I am trying to build a little storefront but I am still having trouble with filtering.
I have a List called, 'Store Data - Categories' with the Title field renamed to 'CategoryName' and another list called 'Store' also with a filed called 'CategoryName'
In my app, I have two galleries 'Options' (which is the 'Store' List in SP) and 'Categories' (which is 'Store Data - Categories' in SP)
I am trying to only show the items (from 'Options') that match the selected category, I tried this but it doesn't work.
SortByColumns(Filter('Store Data - Categories', And(Title = Categories.Selected)))
Can anyone help? Think I might just be confused because I named my Galleries differently to the SP List and I'm not sure what the filter is requiring, but I have tried different combos and they didn't work.
Solved! Go to Solution.
Changing the control name to GroupLabel doesn't impact the how we are trying to use Group which is actual field name.
If you haven't a variable called SortDescending1 that explains why it said the if statement was invalid.
You can still sort by doing this:
SortByColumns( Filter( 'XXXXX Store', Group = Category.Selected.Title ), "Group", Ascending )
OK. Based on another post I think this might be closer but it still fails.
SortByColumns(Filter(Categories, ("CatagoryName" = Categories.Selected.CatagoryName in CatagoryName)), "CatagoryName", If(SortDescending1, Descending, Ascending))
Try this in the Item properties of the second gallery ('Categories').
SortByColumns( Filter( 'Store Data - Categories', Title = Options.Selected.CatagoryName ), "Title", If(SortDescending1, Descending, Ascending) )
This assumes the first gallery is named Options ('Store' List in SP) and the Title column that was renamed is in the Categories gallery ('Store Data' list in SP).
The assumptions are correct but I get an error 'This rule creates a circular reference between properties, which is not allowed. A property cannot reference itself or other properties affected by its value.' Is that because I gave the field the same name in both tables?
OK. I have recreated and named everything a bit better so that I would be less confused. I feel like what I now have should work, but I must still be missing something.
SortByColumns(Filter('XXXXXX Store',GroupLabel=Category.Selected.CategoryName),Group,If(SortDescending1, Descending, Ascending))
'XXXXXX Store' is the name of the SP list that contains all the asset information. It seems to only work when I give this name, not the 'Store' name that is in my app.
All the highlighting seems correct, but it is failing on the sort for some reason.
I also recreated the column one the SP list as I think it was getting confused with them having the same name.
I am not sure if I understand what is in each gallery but lets give it another try. Add this to the Items property of the Options gallery. 'Something Store' should be the name of the list that populates the options gallery (the gallery with all the laptop pics).
SortByColumns( Filter( 'Somthing Store', CategoryName = Categories.Selected.Title ), "CategoryName", If(SortDescending1, Descending, Ascending) )
Hey Jeff, I have just edited my last post as even I was getting confused.
I have a gallery called Category which uses a data source SP list of 'XXXXX - Store Data Categories', The Title field on the SP List holds the info (Desktops/Laptops etc)
I have a second gallery called Store, which uses a data source SP list called 'XXXXX Store', on this one I now have a field called 'Group' that holds a matching group name (Desktops/Laptops etc).
Hopefully, that is less confusing..
Is the new field "Group" or "GroupLabel"? The screenshot shows "GroupLabel". The new field is a Text field and not a choice or lookkup field?
Based on what I understand the Items Property should look something like this:
SortByColumns( Filter( 'XXXXX Store', Group = Category.Selected.Title ), "Group", If(SortDescending1, Descending, Ascending) )
The first gallery (Category) just has 'XXXXX - Store Data Categories' in the Items properties?
New filed is called 'Group' in the SP List (Sharepoint Online), and 'GroupLabel' in the Gallery. When I tried to use the same name in the gallery it was giving an error and making the field black, so I added label to the end of the name to get around that problem.
It is now just a plain text field as before it was a Choice and I couldn't see it to add it to the gallery.
When I try your code I get the same issue as before "The function 'If' has some invalid arguments"
And yes, the first gallery (that has the category images) just has 'XXXXX - Store Data Categories' in the Items properties
I thought this was correct.
SortByColumns(Filter('XXXXX Store',GroupLabel=Category.Selected.CategoryName),Group,If(SortDescending1, Descending, Ascending))
When i look at the highlighting in the image, it looks like it is doing the right thing..
Just when i click it doesn't do anything, although, it also gets same error "The function 'If' has some invalid arguments"
Just adding in my SP list names and Columns
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!