cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
_kikilalaaa
Helper V
Helper V

Multiple Selection for Button in 1 Page

Hi All.

I try to do Sort & Filter Function. Here I have create all the filter by button. For instance, if user click on room number highest to lowest and Compatibility rate highest to lowest, and click 'Apply',

The system will displayed the highest room number with the highest compatibility rate. In this case the sequence would be: room number - 2,3,1

Example:

 

Room NumberCompatibility Rate
13
22
31

 

Does this possible to do in PowerApps? This is so urgent so I hope to get replies soon!

 

Btw this is the interface of the filter.

_kikilalaaa_0-1616434199970.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User II
Super User II

Hi @_kikilalaaa 

Please see the example in the screenshot.  The Items property of the datatable is on the right. It uses two sorts and if neither is chosen the sort is by date. 1.jpg

View solution in original post

5 REPLIES 5
Drrickryp
Super User II
Super User II

@_kikilalaaa 

This can be done using variables and you can do it with a single button as a toggle as follows. Put a button on the screen and set its OnSelect property to 

UpdateContext({SortDescending1: !SortDescending1});
Set(
    sortedlist,
    SortByColumns(
        SPlist,
        "Room",
        If(
            SortDescending1,
            Descending,
            Ascending
        )
    )
)

In your Items property 

sortedlist

You could do something similar for each field that you wanted to sort.  If you wanted to have two buttons lets say for compatibility you could have one as

UpdateContext({SortDescending1: !SortDescending1});
Set(
    sortedlist, SortByColumns(
                               SPlist, "Compatibility",Descending
                 )
)

 and the other button as 

UpdateContext({SortDescending1: !SortDescending1});
Set(
    sortedlist, SortByColumns(
                               SPlist, "Compatibility",Ascending
                 )
)

 

 

Hi @Drrickryp ,

Thanks for replying. In my case, I have set the items as this:

Search(
    With(
   {
      wMarks:
      LookUp(
          'Student Accommodation',
          'Student Name'= varUserName
      )
   },
AddColumns( Filter('Student Accommodations',And('Village Name2'= varVillage,'Village Block'=varBlock,Level1=varLevel)), 
"Difference",
Sqrt((wMarks.'Att 1: Cleanliness' - 'Att 1: Cleanliness')^2 + 
(wMarks.'Att 2: Same Course' - 'Att 2: Same Course')^2 +
(wMarks.'Att 3: Same Religion' - 'Att 3: Same Religion')^2 +
(wMarks.'Att 4: Extrovert level'- 'Att 4: Extrovert level')^2 +
(wMarks.'Att 5: Morning Person'- 'Att 5: Morning Person')^2),
"Other Student",
wMarks.'Student Name'
)
),
TextSearchBox1.Text,
"Room_x0020_Detailed")

How do I apply the sortbycolumns? I am thinking to use If Statement.

If the Button is selected, then the items in the gallery would be the filtered version.

But it didnt work. Hope you can help!

Drrickryp
Super User II
Super User II

Hi @_kikilalaaa 

Please see the example in the screenshot.  The Items property of the datatable is on the right. It uses two sorts and if neither is chosen the sort is by date. 1.jpg

View solution in original post

Hi, it works for me but I put the formula in every if condition hahaha(because I do not know where to put it).

But for Reset, I put UpdateContext({sort1:"",sort2:""} only then it works.

Yep, the other resets were for the dropdowns on my gallery.  Did not apply to yours.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,129)