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

Sort/Filter Gallery with additional parameters.

I have a main screen with a search input box and a gallery. The gallery's Items property is currently using this code:

 

SortByColumns(
    Filter(
        Search(
            'Price Increase List',
            SearchInputBox.Text,
            "Title"
        ),
        HideEntry = "N"
    ),
    "ID",
    If(
        SortDescending1,
        Ascending,
        Descending
    )
)

Where it filters for items in the SP Online list which have the "HideEntry" field set to "N". Everything works as expected.

 

Now my boss wants me to add an icon in the menu to show all of the entries (so HideEntry set to "N" or "Y")... how do I get an icon to change the search/filter criteria? I was thinking of using a Global Variable set to "N" and putting that in the code instead (something line 'HideEntry = GlobalVar') and then having the icon change the variable to "Y", but that would only show the hidden entries and not the open (visible) entries as well.

 

@Jeff_Thorpe  Suggestions would be greatly appreciated! 

 

Thanks,

gpence

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Sort/Filter Gallery with additional parameters.

Ok, cool, we can do that Smiley Happy So if we put it inside an Or ||, then we can filter it to additionally include whatever we set from the icon:

 

 

App's OnStart:

Set(HideEntryValue, "Nothing")

 

Icon's OnSelect:

 

If(
HideEntryValue = "Y",
Set(HideEntryValue, "Nothing");
Notify("Hidden values are now hidden", NotificationType.Information)
,
 Set(HideEntryValue, "Y");
Notify("All values are now shown", NotificationType.Information)
)

 

 

Gallery's Items:

SortByColumns(
    Filter(
        Search(
            'Price Increase List',
            SearchInputBox.Text,
            "Title"
        ),
        HideEntry = "N"
||
HideEntry = HideEntryValue
), "ID", If( SortDescending1, Ascending, Descending ) )

 




Don't forget to 'Mark as Solution' and 'Thumbs Up' those who deserve it!

View solution in original post

5 REPLIES 5
shailendra74
Level 10

Re: Sort/Filter Gallery with additional parameters.

Hi @gpence 

 

You can use the tooltip property of icon/image you place and use the tooltip value in your filter criteria.

 

When filtering you need to use the other value (like if you show "Y" then filter on "N" and so on..)

 

Thanks.

Super User
Super User

Re: Sort/Filter Gallery with additional parameters.

Hello,

 

So you would have variable declared initially on App Start, then your icon's OnSelect set a variable and then change to the other value if selected. You should then also have a way of showing the user that this is the case. So you could have the onselect change the colour of the icon, or you could use a Notify to let the user know. Let's use notify to make things easier:

 

App's OnStart:

Set(HideEntryValue, "N")

 

Icon's OnSelect:

 

If(
HideEntryValue = "N",
Set(HideEntryValue, "Y");
Notify("Hidden values are now shown", NotificationType.Information)
,
 Set(HideEntryValue, "N");
Notify("Hidden values are now hidden", NotificationType.Information)
)

 

 

Gallery's Items:

SortByColumns(
    Filter(
        Search(
            'Price Increase List',
            SearchInputBox.Text,
            "Title"
        ),
        HideEntry = HideEntryValue
    ),
    "ID",
    If(
        SortDescending1,
        Ascending,
        Descending
    )
)

 

 

If you have any issues implementing this, let me know,

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' and 'Thumbs Up' those who deserve it!
gpence
Level: Powered On

Re: Sort/Filter Gallery with additional parameters.

Hi @iAm_ManCat ,

 

Thank you for this example, but I don't think I expressed my needs clearly.

 

If I read your solution correctly, this will toggle between the visible ("N") and the hidden ("Y") entries. What I need the icon to do is to show ALL (so the HideEntry = ["N" or "Y"]). Does that make sense?

 

Thanks,

gpence

 

 

Super User
Super User

Re: Sort/Filter Gallery with additional parameters.

Ok, cool, we can do that Smiley Happy So if we put it inside an Or ||, then we can filter it to additionally include whatever we set from the icon:

 

 

App's OnStart:

Set(HideEntryValue, "Nothing")

 

Icon's OnSelect:

 

If(
HideEntryValue = "Y",
Set(HideEntryValue, "Nothing");
Notify("Hidden values are now hidden", NotificationType.Information)
,
 Set(HideEntryValue, "Y");
Notify("All values are now shown", NotificationType.Information)
)

 

 

Gallery's Items:

SortByColumns(
    Filter(
        Search(
            'Price Increase List',
            SearchInputBox.Text,
            "Title"
        ),
        HideEntry = "N"
||
HideEntry = HideEntryValue
), "ID", If( SortDescending1, Ascending, Descending ) )

 




Don't forget to 'Mark as Solution' and 'Thumbs Up' those who deserve it!

View solution in original post

gpence
Level: Powered On

Re: Sort/Filter Gallery with additional parameters.

Awesome, ManCat. Thank you so much!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 397 members 2,975 guests
Please welcome our newest community members: