cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Smart textbox filter function

Hello!

I am using 2 checkboxes & a textsearch box to filter my dropdownbox. Whenever I search for M8, I get all of the results with M8 inside of it. 

What if I also know the length is 70. So then I would type in M8 70, currently the result does not show up when I search for that, as it is not an exact match.  

M8 search results: https://gyazo.com/e640a45cc5b9d954a2ff63a5d4ecf94b
M8 70 search results: nothing

How can I make this a smart search function? Thanks in advance!

Here is my code for the dropdown: 

 

SortByColumns(
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)
   )
); "Result")

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Do you want to filter the Dropdown box records based on multiple search keys?

 

Regarding the needs that you want to achieve, I afraid that there is no direct way to achieve your needs. As an alternative solution, I think the collection could achieve your needs.

 

I have made a test on my side, please try the following workaround:

Set the OnChange property of the TekstZoekVeld_1 box to following:

ClearCollect(
             RecordsCollection;
             If(
                 Checkbox2_1.Value = false && Checkbox2.Value = true; 
                 If(
                     IsBlank(TekstZoekVeld_1.Text);
                     Distinct(
                               Lijst_Eindp;
                               Omschrijving
                     );
                     Distinct(
                             ForAll(
                                   Split(TekstZoekVeld_1.Text; " ");
                                   Filter(
                                          Lijst_Eindp;
                                          Result in 'Prod. usage'|| Result 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(
                              ForAll(
                                     Split(TekstZoekVeld_1.Text; " ");
                                     Filter(Lijst_Eindp; 'Prod. usage'="Bev M; Montage"; Result in Omschrijving)
                              );
                              Omschrijving
                     )
               )
            )
)

 

Set the Items property of the Dropdown box to following:

RecordsCollection

Note: When you select the Dropdown box, it would be populated with proper records from the RecordsCollection automatically.

 

Please try above solution, then check if the issue is solved.

 

Regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
BrianS
Super User
Super User

Are all your initial searches 2 characters - like the M8 you mention? Then you may be able to strip out the value using the Right or Left functions. It may be easier to have a separate input to capture the length of the string and then use the Len function and the IsBlank function to test for length 

Anonymous
Not applicable

Thank you for your answer @BrianS 

Not all searches will be 2 characters sadly. So this is not an option

v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Do you want to filter the Dropdown box records based on multiple search keys?

 

Regarding the needs that you want to achieve, I afraid that there is no direct way to achieve your needs. As an alternative solution, I think the collection could achieve your needs.

 

I have made a test on my side, please try the following workaround:

Set the OnChange property of the TekstZoekVeld_1 box to following:

ClearCollect(
             RecordsCollection;
             If(
                 Checkbox2_1.Value = false && Checkbox2.Value = true; 
                 If(
                     IsBlank(TekstZoekVeld_1.Text);
                     Distinct(
                               Lijst_Eindp;
                               Omschrijving
                     );
                     Distinct(
                             ForAll(
                                   Split(TekstZoekVeld_1.Text; " ");
                                   Filter(
                                          Lijst_Eindp;
                                          Result in 'Prod. usage'|| Result 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(
                              ForAll(
                                     Split(TekstZoekVeld_1.Text; " ");
                                     Filter(Lijst_Eindp; 'Prod. usage'="Bev M; Montage"; Result in Omschrijving)
                              );
                              Omschrijving
                     )
               )
            )
)

 

Set the Items property of the Dropdown box to following:

RecordsCollection

Note: When you select the Dropdown box, it would be populated with proper records from the RecordsCollection automatically.

 

Please try above solution, then check if the issue is solved.

 

Regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,536)