cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

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? 🙂

1 ACCEPTED SOLUTION

Accepted Solutions

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.
🙂 
Thanks and have a nice day everybody. 

View solution in original post

5 REPLIES 5
Community Support
Community Support

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.

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 🙂

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

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
    )
)

 

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

Change this:

UpdateContext({viewNotReceived: !viewNotReceived});


to this:

UpdateContext({viewReceived: !viewNotReceived});

 

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.
🙂 
Thanks and have a nice day everybody. 

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Users online (8,911)