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

Filtering Gallery by true or false!

Hi im trying to filter my gallery when selecting (Received) button, when i press the recieved button i want only to see all received items from the gallery.


Here is my code in BrowseGallery - Items:

SortByColumns(
    Filter(
        Filter(Tailoring, RECEIVED = viewReceived),
        Store = myEmail,
        StartsWith(
            'Customer Name',
            TextSearchBox1_2.Text
        ) || StartsWith(
            Number,
            TextSearchBox1_2.Text
        )
    ),
    "Date",
    If(
        SortDescending1,
        Descending,
        Ascending
    )
)

Code in the Received button - Onselect:

UpdateContext({viewNotReceived: !viewNotReceived});

Code in the BrowseScreen - OnVisible:

UpdateContext({viewNotReceived: true})

This code only shows NOT received items, I want it to show Received Items.

 

Anyone that have a solution? or tips? Smiley Happy

1 ACCEPTED SOLUTION

Accepted Solutions
OlofGrandez
Level: Powered On

Re: Filtering Gallery by true or false!

Hi thanks for the help. 

it took a time to figure it out what i was doing wrong. 

 

So this is the right code to use if you want to filter via true or false.

0 means No

1 means Yes

 

SortByColumns(
Filter(
Filter(Tailoring, RECEIVED = 1), 


so this code solved my question.
Smiley Happy 
Thanks and have a nice day everybody. 

5 REPLIES 5
Community Support Team
Community Support Team

Re: Filtering Gallery by true or false!

Hi @OlofGrandez ,

Could you tell me

1)what's the data source that you use?

2)what's the data type of the 'RECEIVE' field?

3)what values are in 'RECEIVE' field? Are boolen values?

Do you want to show all items in the gallery in the beginning, display 'RECEIVE' items after clicking the button once, display 'NOT RECEIVE' items after clicking the button twice?

 

Best regards,

Community Support Team _ Phoebe Liu

 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
OlofGrandez
Level: Powered On

Re: Filtering Gallery by true or false!

Hi, sorry for not being clear.

My data source is from a SharePoint list called “Tailoring”.

My field value is a Boolean with the values yes/no (true/false)
I have used a toggle to make it yes on true and no on false.

I have three different browseScreen that have the same gallery but filter different.

In screen 1 all the items that are received and not received items shows up, (yes and no, true/false).

In screen 3 it shows all the items that are not received,
(No, false).

But in the screen 2 I want all the received items to show. (Yes, true).
I have tried to reuse the same code I used to filter not received, but on the contrary, but I can’t figure it out. :/
I hope you understand my problem, just tell me if I wasn’t clear enough Smiley Happy

I’m on my phone right now so I can’t send photos via this comment,
But I send it via we transfer if you want to see how the screens look like.

https://we.tl/t-46V5e9q0Tb

Best regards
Olof
AccuFloDev
Level: Powered On

Re: Filtering Gallery by true or false!

Hey @OlofGrandez ,


My first thought is your filter code has a bug, based on the code you were showing in your first post (See bolded text below):

SortByColumns(
    Filter(
        Filter(Tailoring, RECEIVED = viewReceived), //<-- Shouldn't this be viewNotReceieved?
        Store = myEmail,
        StartsWith(
            'Customer Name',
            TextSearchBox1_2.Text
        ) || StartsWith(
            Number,
            TextSearchBox1_2.Text
        )
    ),
    "Date",
    If(
        SortDescending1,
        Descending,
        Ascending
    )
)

 

AccuFloDev
Level: Powered On

Re: Filtering Gallery by true or false!

Actually, after re-reading your first post, I think your bug is here:

Change this:

UpdateContext({viewNotReceived: !viewNotReceived});


to this:

UpdateContext({viewReceived: !viewNotReceived});

 

OlofGrandez
Level: Powered On

Re: Filtering Gallery by true or false!

Hi thanks for the help. 

it took a time to figure it out what i was doing wrong. 

 

So this is the right code to use if you want to filter via true or false.

0 means No

1 means Yes

 

SortByColumns(
Filter(
Filter(Tailoring, RECEIVED = 1), 


so this code solved my question.
Smiley Happy 
Thanks and have a nice day everybody. 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

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

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 221 members 4,793 guests
Please welcome our newest community members: