cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Daemagor
Helper II
Helper II

Help with Multiple Filters in Gallery

I am currently working on a ticketing system and ran into some issues that I cannot figure out how to solve.

 

On the main screen, you are able to see every single ticket that was made. When the user inputs the ticket ID number or the ticket's title, the gallery would display what the user is looking for.

What I am trying to do is add two more filters. 

  1. Only allow the tickets that are created by the user, who is signed into office365, and show
  2. Tickets that are not closed to be visable by the user who created the ticket.

Below is what I currently have:

If(IsBlank(TextSearchBox1.Text),
    SortByColumns(Filter(Tickets, Filter(Tickets, StartsWith(Title, TextSearchBox1.Text)), "ID"),ThisItem.Name = Office365Users.UserProfile() , 

    If(SortDescending1, Descending, Ascending)),

        If(IsNumeric(Value(TextSearchBox1.Text)),

            SortByColumns(Filter(Tickets, ID = Value(TextSearchBox1.Text)), "ID", If(SortDescending1, Descending, Ascending)),
 
            SortByColumns(Filter(Tickets, StartsWith(Title, TextSearchBox1.Text)), "ID", If(SortDescending1, Descending, Ascending))))

I dont know if you can have multiple filters nested within each other or I am getting confused.

9 REPLIES 9
Anonymous
Not applicable

for example in my app I have the following multiple filter:

 

If(Dropdown_Filter.Selected.Value="FILTER NEW", Filter('[dbo].[SuggestionBox]',TicketStatus="NEW"),If(Dropdown_Filter.Selected.Value="FILTER ON HOLD", Filter('[dbo].[SuggestionBox]',TicketStatus="ON HOLD"), If(Dropdown_Filter.Selected.Value="FILTER CLOSED", Filter('[dbo].[SuggestionBox]',TicketStatus="CLOSED"),If(Dropdown_Filter.Selected.Value="FILTER IN PROCESS", Filter('[dbo].[SuggestionBox]',TicketStatus="IN PROCESS"),'[dbo].[SuggestionBox]'))))

Its pretty straight forward.This formula above assigned to ITEMS in the Gallery.Works great so far.

 

 

mr-dang
Community Champion
Community Champion


@Daemagor wrote:

I dont know if you can have multiple filters nested within each other or I am getting confused.


Hi,

You can add more conditions to a filter in three ways:

  1. Use the And operator
    Filter(datasource,And(condition1,condition2))
  2. Use && instead of And
    Filter(datasource,condition1 && condition2)
  3. Use a comma. By chance, the Filter function can take as many conditions as you want separated by commas:
    Filter(datasource,condition1,condition2,conditionx)
Microsoft Employee
@8bitclassroom

@mr-dang,

 

I have one more question for this extravagent piece of a puzzle I have. 

 

If(IsBlank(TextSearchBox1.Text),

 SortByColumns(Filter(Tickets, StartsWith(Title, TextSearchBox1.Text), ThisItem.Name.DisplayName = User().FullName && ThisItem.Status.Value <> "Completed"), "ID", If(SortDescending1, Descending, Ascending)),

 If(IsNumeric(Value(TextSearchBox1.Text)),

 SortByColumns(Filter(Tickets, ID = Value(TextSearchBox1.Text)), "ID", If(SortDescending1, Descending, Ascending)),
 
 SortByColumns(Filter(Tickets, StartsWith(Title, TextSearchBox1.Text)), "ID", If(SortDescending1, Descending, Ascending))))

The part where I have multiple filters is where its throwing an error. 

ThisItem.Name.DisplayName = User().FullName && ThisItem.Status.Value <> "Completed")

 

ThisItem.Name.DisplayName & ThisItem.Status.Value have: Invalid use of "."

FullName: Part of this filter formula cannot be evaluated remotly due to service limitions.

 

FullName isnt an issue when this goes into production from what I have seen in the past, unless you see it as one.

Error is not going away. I do not understand why a label can use ThisItem.Name.DisplayName and display the name but when you use it with the filter, it complains aout "."

Anonymous
Not applicable

Can you create a label and push ThisItem.Name.DisplayName to it value and then use Label.Text in the filter formula?

@Anonymous,

 

No I cannot, it gives me 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.

 

 SortByColumns(Filter(Tickets, StartsWith(Title, TextSearchBox1.Text) && Ticket_Creator.Text), "ID", If(SortDescending1, Descending, Ascending))

Do I understand that you are having issue with filtering a people/group column by the current powerapp user name?

Try

User().FullName in Team.DisplayName

 

Hello Mr.Dang,

 

Greetings for the day ! Happy to contact you back,

 

Below is the powerapp which i am using to filter the gallery(documents) from the sharepoint library.

 

I have tried with many filter possibilites but it works either ways but i am looking for 2 sort of filters at a same time and also to download the multiple documents using checkbox.

 

1. Is it possible to filter the gallery by selecting values from the dropdown individually, For Ex: if i select training level "- " , i need to see or filter only training level documents which was defined in the sharepoint doc library and same way goes to all the dropdown, Application, Package, Language, etc. What i meant is more the filter applies to dropdown it should start filtering the gallery with matching criteria.Well i am using Distinct(Table,Column name) for the all the drop downs to fetch the values.

 

And also i need to see all the documents from the sharepoint library without any filter, later when i select Application "general" it should filter only Application which is avaliable, later when Application selected and training level selected should match both and provide output and same way goes to all the dropdowns.

 

2. Second approch, If i set values to all the dropdowns according to the selection i need see the results in the gallery.

 

3. There is a displaymode set to the below 3 dropdowns, i have value in training level when i select "-" other two dropdowns will be invalid.

 

4.. On Items for gallery, like i said it works either ways(since i am using "And"/"Or"). So it is either working for "And" otherwise "Or " Sort(Filter('Test Document',And(Training_x0020_Level=Dropdown1.Selected.Value,Application.Value=Dropdown2.Selected.Value,Package.Value=Dropdown3.Selected.Value,Language.Value=Dropdown4.Selected.Value,Medium.Value=Dropdown5.Selected.Value)),Modified,Descending). In my case it should work for both.

 

Is it possible to download multiple files within the gallery, in my case i have gallery which has a document library from Sharepoint.

 

And i have added the checkbox controller to the gallery, so that when needed user can select the multiple documents using checkbox and download in zip file or normal download but do we have any command to establish this issue? However i can dowload or launch the single file at a time.

 

Capture20.PNGCapture11.PNG

 

Thanks and Regards,

Nikhil.

@Nikhil2,

 

Please do not "hijack" this thread and revive an old thread, create a new thread next time. 

Thank You,
~ Dae

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (82,680)