cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

Filter gallery based on 2 checkboxes & searchbox

Hello everyone!

Formula I have right now: 

If(
   Checkbox2_1.Value = false && Checkbox2.Value = true; 
  If(
    IsBlank(TekstZoekVeld_1.Text);
    Distinct(
        Lijst_Eindp;
        Omschrijving
    );
    Filter(
        Distinct(
            Lijst_Eindp;
            Omschrijving
        );
        TekstZoekVeld_1.Text in Result
    )
))

 

What we need to add is an if statement that checks the other way around, Checkbox2_1.value = true && Checkbox 2.value = false

Then it needs to get information out of the database Lijst_Eindp

Out of this database we are going to use 2 columns. One is named 'Prod. usage' and one is named Omschrijving. So whenever checkbox2_1 is true and checkbox 2 is false, it needs to show all Omschrijving rows where 'Prod. usage' is equal to "Bev. M; Montage"

I also have a searchtextbox. Whenever they type something in here, it needs to filter the amount of options inside of my dropdown (Omschrijving). 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @TimoMigchielsen ,

 

That is a Dropdown limitation, not a delegation issue. Hence, Collection can't resolve this issue. The only way is to use Gallery as the dropdown list.

 

The issue you post above does could be a Delegation issue since In operator is undelegable for SharePoint. Please change to use StartsWith function.

If(
   Checkbox2_1.Value = false && Checkbox2.Value = true; 
  If(
    IsBlank(TekstZoekVeld_1.Text);
    Distinct(
        Lijst_Eindp;
        Omschrijving
    );
    Distinct(
    Filter(
            Lijst_Eindp;
        StartsWith('Prod. usage',TekstZoekVeld_1.Text)|| StartsWith(Omschrijving,TekstZoekVeld_1.Text)
    );Omschrijving)
  );
   Checkbox2_1.Value = true && Checkbox2.Value = false; 
   If(
    IsBlank(TekstZoekVeld_1.Text);
    Distinct(Filter(Lijst_Eindp; 'Prod. usage'="Bev M; Montage"),Omschrijving);
    Distinct(Filter(Lijst_Eindp; 'Prod. usage'="Bev M; Montage",StartsWith(Omschrijving,TekstZoekVeld_1.Text)),Omschrijving)
   )
)

 Hope this helps.

Sik

View solution in original post

14 REPLIES 14
Post Prodigy
Post Prodigy

Anyone able to help me with this?

Super User II
Super User II

A few observations:

You can simply keep extending your If statement to function as If, Else If, Else

If(
    // If Branch
    Checkbox1.Value = false && Checkbox2.Value = true,
    If(
        IsBlank(TekstZoekVeld_1.Text),
        Distinct(
            Lijst_Eindp,
            Omschrijving
        ),
        Filter(
            Distinct(
                Lijst_Eindp,
                Omschrijving
            ),
            TekstZoekVeld_1.Text in Result
        )
    ),
    // Else If Branch
    Checkbox1.Value = true && Checkbox2.Value = false,
    If(
        IsBlank(TekstZoekVeld_1.Text),
        Distinct(
            Lijst_Eindp,
            Omschrijving
        ),
        Filter(
            Distinct(
                Lijst_Eindp,
                Omschrijving
            ),
            TekstZoekVeld_1.Text in Result
        )
    ),
    // Else
    Blank()
)

I copied the first branch and just inverted the logic. You'd need to update for your purposes to include your new columns.

 

The DropDown usage I think is a bit backwards - at least how you've asked for it to be used relative to it being included in the function. "Whenever they type something in here, it needs to filter the amount of options inside of my dropdown (Omschrijving)" Where is this drop-down? In the function, it's used as a filter parameter explicitly. Are you trying to filter the gallery using this dropdown, or filter the drop-down based on the checkboxes being checked?

Thank you for your answer @GarethPrisk 

Sorry for confusing you. I will explain it better now.

We're filtering a dropdown box. The code you sent me will be inside of the "Items" section for the dropdown box. 

 

This is what I want:

1. When Checkbox1.Value = true && Checkbox2.Value = false

I want it to filter the dropdown box on "Bev M; Montage". The column name is "Prod. usage", the database name is "Lijst_eindp". Now it may get a little bit complicated. So I want to filter it on the column "Prod. usage" on all values with "Bev M; Montage" but instead of getting the "Bev M; Montage, I want to lookup the column Omschrijving that has "Bev M; Montage" as "Prod. usage". 

To explain this, I'll attach a picture down here. So basically what should happen if Checkbox1 = true, it should filter on "Bev M; Montage" and show the "Omschrijving". For this example it would show only 1 row, as there is only 1 bev montage.  

TimoMigchielsen_0-1597646089480.png

 

 

2. Right now you can only search using the same column as the information is in. For example: 

if this would be the only result in the dropdown box (It would only show the Omschrijving). You can only search on "PaneelHek L= 2304 B= 864 D= 60"

How can I make it so I can also search for "3000-V-E; glaspaneel" and it will show all of the "Omschrijving" that are available?

TimoMigchielsen_1-1597646207235.png

Thanks for your response in advance! 

 

Community Support
Community Support

Hi @TimoMigchielsen ,

 

I am a little confused. Is the search you mentioned in point 2 based on the filtered list in point 1?

If so, please try this.

If(
   Checkbox2_1.Value = false && Checkbox2.Value = true; 
  If(
    IsBlank(TekstZoekVeld_1.Text);
    Distinct(
        Lijst_Eindp;
        Omschrijving
    );
    Filter(
        Distinct(
            Lijst_Eindp;
            Omschrijving
        );
        TekstZoekVeld_1.Text in Result
    )
);
   Checkbox2_1.Value = true && Checkbox2.Value = false; 
   RenameColumns(Search(Filter(Lijst_Eindp; 'Prod. usage'="Bev M; Montage");searchtextbox.Text;"Prod. usage").Omschrijving;"Omschrijving";"Result")
)

If not, the search is in the first priority, right?

If(IsBlank(searchtextbox.Text);
If(
   Checkbox2_1.Value = false && Checkbox2.Value = true; 
  If(
    IsBlank(TekstZoekVeld_1.Text);
    Distinct(
        Lijst_Eindp;
        Omschrijving
    );
    Filter(
        Distinct(
            Lijst_Eindp;
            Omschrijving
        );
        TekstZoekVeld_1.Text in Result
    )
);
   Checkbox2_1.Value = true && Checkbox2.Value = false; 
   RenameColumns(Filter(Lijst_Eindp; 'Prod. usage'="Bev M; Montage").Omschrijving;"Omschrijving";"Result")
);
RenameColumns(Search(Lijst_Eindp;searchtextbox.Text;"Prod. usage").Omschrijving;"Omschrijving";"Result")
)

Hope this helps.

Sik 

Thank you for your answer @v-siky-msft .

I just tried your code but it gives me an error for the search function. 

 

I'll make it a little bit more visible:

 

If checkbox 2_1 = true && 2 = false

1. It has to show the column "Omschrijving"
2. It needs to filter the column "Prod. usage" on "Bev M; Montage" and it needs to show the "Omschrijving" for each row that has the prod usage "Bev M; Montage".
3. The search then just searched for the Omschrijving

 

If checkbox 2 = true && 2_1 = false
1. It has to show the column "Omschrijving"
2. Search option needs to search both columns if possible, Omschrijving & Prod. usage. 

When they are both false, show nothing

Thank you for your answer in advance!

Hi @TimoMigchielsen ,

 

Got it. Please try this.

If(
   Checkbox2_1.Value = false && Checkbox2.Value = true; 
  If(
    IsBlank(TekstZoekVeld_1.Text);
    Distinct(
        Lijst_Eindp;
        Omschrijving
    );
    Distinct(
    Filter(
            Lijst_Eindp;
        TekstZoekVeld_1.Text in 'Prod. usage'|| TekstZoekVeld_1.Text in Omschrijving
    );Omschrijving)
  );
   Checkbox2_1.Value = true && Checkbox2.Value = false; 
   If(
    IsBlank(TekstZoekVeld_1.Text);
    Distinct(Filter(Lijst_Eindp; 'Prod. usage'="Bev M; Montage"),Omschrijving);
    Distinct(Filter(Lijst_Eindp; 'Prod. usage'="Bev M; Montage",TekstZoekVeld_1.Text in  Omschrijving),Omschrijving)
   )
)

 Sik

I think this works.

It says the maximum amount has been reached though. Is there anything I can do about this? @v-siky-msft 

Hi @TimoMigchielsen ,

 

 

It seems you have reached the maximum numbers of items that can be list in dropdown box.

 

Could you please consider changing to use Gallery to work as a dropdown?

Add a Textinput to display the selected items, put the code above to Gallery.Items property that can show entire table, Set the Gallery visible property to hide it in until the textinput is clicked. At last, use Gallery.Selected code to output the selection.

 

Hope this helps.

Sik

@v-siky-msft 

I do not want to use a gallery, is there no other option? @v-siky-msft 

Are we not able to create a collection of my database and then use the collection name instead of my database?

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 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!

Top Solution Authors
Top Kudoed Authors
Users online (6,665)