cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Daemagor
Level: Powered On

Distinct Filter and Sort on Gallery

Hey all,

 

I am looking to make a Tablet view of the ticket system that I am currently working on at the moment.Capture.PNG

 

As you can see with the image, I have buttons and I have a gallery below the buttons. I have two goals to be accomplished with this.

  1. What I am trying to do is have a gallery or buttons, which ever is easier, to display the status of the tickets. Using the Gallery, do I use:
    distinct(filter(datasource, status))
     

    The buttons are an easy fix since you can just use UpdateCOntext and use a global variable, but they dont look pleasing to the eye vs the gallery. 

  2. The other thing I am trying to get to work is with this selection of the status, in another gallery, I will show the tickets with said selected status. EX I select "in progress tickets", all the in progress tickes will show and vice versa. TicketView is the variable that sets the filter on the gallery.
  3. Filter(Tickets_1,If(TicketView = "Open", show all open tickets, If(TicketView = "In Progress", show all in progress tickets, If(...........))))

Any help would be appriciated. Thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Distinct Filter and Sort on Gallery

Change Gallery1.Item to

Distinct(Tickets_1, Status.Value)

Change the Label to

ThisItem.Result

View solution in original post

14 REPLIES 14
Anonymous
Not applicable

Re: Distinct Filter and Sort on Gallery

1. To have gallery with distinct ticket statuses use this for Galery.Item 

 

Distinct(DataSource,status)

To show how many tickets have the specific status use this formula for one of the gallery items

CountRows(Filter(DataSource, status = ThisItem.Result))

Here is how something similar would look like for Airport codes:

13.png

 

Change the code of the arrow OnSelect property to:

Navigate(Screen2,None,{TktStatus:ThisItem.Result})

On Screen2 add gallery and change Gallery2.Item to this:

Filter(DataSource,status=TktStatus)

And you will get something like this:

14.png

Daemagor
Level: Powered On

Re: Distinct Filter and Sort on Gallery

@Anonymous,

 

Thank you for the response. Inside the ticket gallery,  

CountRows(Filter(Tickets_1, Status = ThisItem.Result))

 The equals is spitting out an error, Invalid argument type. I have tried Status.Value and Status.Item, while Status.Value will spit out on Value: Suggestion: Part if this filter formula cannot be evaluated remotly due to service limitations..... I also have changed the equals sign to in and the .Result spits out: Invalid arg type. Cannont use record values in  this context. But I have one more change to this and thats when I do this: 

CountRows(Filter(Tickets_1, Status.Value in ThisItem.Result.Value))

That has an output of 3, which I do not want. I am trying to get: Open Ticket, In Progress Ticket, Waiting Ticket as the output.

Anonymous
Not applicable

Re: Distinct Filter and Sort on Gallery

Couldn't you just do CountRows(Filters(Tickets_1, Status=ThisItem.Status)) or am I missing what you are trying to accomplish here?

Daemagor
Level: Powered On

Re: Distinct Filter and Sort on Gallery

@Anonymous,

 

I updated the post above you, take a look at what I recently added to the post. But theres a problem with CountRows(Filters(Tickets_1, Status=ThisItem.Status)). Status is an invalid name at that point.

Anonymous
Not applicable

Re: Distinct Filter and Sort on Gallery

Hi @Daemagor

 

Do you want the name of status or number of how many tickets there are with specific status?

 

If you want the name just change label.Text to

ThisItem.Result

If you want the number of tickets with specific status change label.Text to

CountRows(Filter(Tickets_1, Status = ThisItem.Result))

 ThisItem.Result only works inside Gallery Card so make sure your label is inside the gallery card otherwise you get an error.

 

Pictures with what you have would help to solve it faster.

 

Here is what I mean by inside gallery or outside:

1.png

Anonymous
Not applicable

Re: Distinct Filter and Sort on Gallery

Well the CountRows function is literally counting how many of said condition you have so that is going to be a number. So if you aren't expecting a number that isn't going to work for you.

Daemagor
Level: Powered On

Re: Distinct Filter and Sort on Gallery

@Anonymous & @Anonymous,

 

I want the name not the number, sorry for the confusion. But ThisItem.Result on result is spiting and error that it expects a Text value but the rule produces incompatible record values.

 

This is inside the gallery too

Anonymous
Not applicable

Re: Distinct Filter and Sort on Gallery

Your Gallery.Item is this?

Distinct(Tickets_1, Status)

If yes

 

ThisItem.Result will be the name of the Status

 

For it to work you have to put it inside Gallery card not outside, if you put outside you get invalid argument type.

 

Again posting a picture of what you have setup would make it easier to solve

Daemagor
Level: Powered On

Re: Distinct Filter and Sort on Gallery

Capture.PNGCapture.PNG

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 346 members 6,963 guests
Please welcome our newest community members: