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

Filter Gallery Combobox Choice with textinput or other combobox?

Hey

 

I have a gallery called Gallery1

I have 4 columns in Gallery1 based of an datasource from Sharepoint list.

Above each column i have a textbox to search in the list. This works great with the Filter function.

Filter('Underlag Kostnader';TextInput1.Text in Beskrivning;TextInput1_1.Text in Rubrik;TextInput1_2.Text in Skapad)

 

Underlag Kostnader = sharepoint list.

Beskrivning, Rubrik, Skapad = 3 columns in the Gallery.

Then i have a forth column called STATUS

 

I want to be able to filter on Status column aswell.

But the data-type of this column is a choices (dropdown).

How can i add to above filter code to filter on a dropdown either with a textbox input or a dropdown input.

 

I have tried this:

Filter('Underlag Kostnader';TextInput1.Text in Beskrivning;TextInput1_1.Text in Rubrik;TextInput1_2.Text in Skapad;Dropdown1.Selected.Value in Status)

 

Also this

Filter('Underlag Kostnader';TextInput1.Text in Beskrivning;TextInput1_1.Text in Rubrik;TextInput1_2.Text in Skapad;TextInput2.Text in Status)

Does not work

 

Anyone able to help`?

Does not work, get error that i cant use Status.

16 REPLIES 16
Super User
Super User

Re: Filter Gallery Combobox Choice with textinput or other combobox?

This is what I would use:

 

Search(Filter('Underlag Kostnader', Status.Value=Dropdown1.Selected.Value), TextInput1.Text, "Beskrivning", "Rubrik","Skapad")

 

If you use search for your text input you don't have to use in because it is a given and then filter works good against dropdown options. 

 

I would also suggest you use a Combo Box instead of a dropdown for the status if you want them to have to ability to see all status that are there. A dropdown will make you pick a choice and a combo box you can have blank.

 

Let me know if you need any further detail.

 

Oskarkuus
Level: Powered On

Re: Filter Gallery Combobox Choice with textinput or other combobox?

I have tested your code.

I put it on the gallery´s item function where i had my code.

 

Just copy paste your code gives the errors

that i need to change the comma ( , )

So i changed them to semicolon ;

 

But then i get the error that column SKAPAD does not exist.

Column skapad is the sharepoint list date column CREATED when the line was created.

Should i call it something els?

I tested to rename it to Created but then i got the error

 

I also get the error that the function Search "not enough arguments".

 

Search(Filter('Underlag Kostnader';Status.Value=Dropdown5.Selected.Value); TextInput1.Text; "Beskrivning"; "Rubrik";"Skapad")

 

I also get the error that Rubrik does not exist.

 

So i cant understand why i get all errors. When my code worked before.

And i rather have several textboxes that search in one column each, then i can do really fine searches.

 

 

Super User
Super User

Re: Filter Gallery Combobox Choice with textinput or other combobox?

Dates will be different if you are wanting to search by that you will have to split that out. 

 

The one I tested I did has :

 

Search(Filter(SPListName, Status.Value=Dropdown1.Selected.Value), TextInput1.Text, "Column1","Column2")

 

With Column 1 and 2 being text fields and Status being a choice field. Try removing your date column and make sure it works without that and then we can put that back in. I usually like to break it down a little at a time if I am having trouble with something. 

 

I'm not sure about the semi-colon instead of a comma...I normally only use a semi-colon when starting a new statement.

Oskarkuus
Level: Powered On

Re: Filter Gallery Combobox Choice with textinput or other combobox?

It is so weird, i dont get it.

 

This line works in the Items function on the gallery:

Search(Filter('Underlag Kostnader'; Status.Value=Dropdown5.Selected.Value); TextInput1.Text; "Beskrivning";"Title")

 

(had to use Title instead of Rubrik since it was the origianal field name in the sharepoint list).

 

But how can i now

1. Add so i search the column Skapad (the date when the row was created).

2. Add so i keep my search boxes above each column. Search for column1 in textbox1, column2 in textbox2, columnd3 in textbox3.... and so on (and one of the columns is the dropdown5 that i search in one column.

 

 

 

 

Super User
Super User

Re: Filter Gallery Combobox Choice with textinput or other combobox?

To add in the date part you have to either add in a date picker or have a way where it is converted to text. 

 

Would a date picker work or you want where they can type in dates as text?

Oskarkuus
Level: Powered On

Re: Filter Gallery Combobox Choice with textinput or other combobox?

I dont mind a date picker.

But how come it worked to search in date when using this code?

Filter('Underlag Kostnader';TextInput1.Text in Beskrivning;TextInput1_1.Text in Rubrik;TextInput1_2.Text in Skapad)

Bold = date line

 

Could i use this line that works fine now

Search(Filter('Underlag Kostnader'; Status.Value=Dropdown5.Selected.Value); TextInput1.Text; "Beskrivning";"Title")

and combine it somehow with above?

Like add an & and then a new Filter('Underlag Kostnader';TextInput1_2.Text in Skapad)

 

Super User
Super User

Re: Filter Gallery Combobox Choice with textinput or other combobox?

I haven't done it in a text search in a while so I can't remember why I found it to be an issue. 

 

You could combine if it is working fine for you and do:

 

Search(Filter('Underlag Kostnader'; Status.Value=Dropdown5.Selected.Value || TextInput1_2.Text in Skapad); TextInput1.Text; "Beskrivning";"Title")

 

You can replace the "||" with && if you want both the status and the date at same time... "||" will be for OR

 

 

 

 

Community Support Team
Community Support Team

Re: Filter Gallery Combobox Choice with textinput or other combobox?

Hi @Oskarkuus ,

Could you please share a bit more about the error message with your formula?

 

I agree with @rebeccas 's thought almost. You could consider take a try to add a DatePicker control within your app to filter your Skapad column.

I have made a test on my side, please take a try with the following workaorund:

Set the Items property of the Gallery to following:

Filter(
'Underlag Kostnader';
TextInput1.Text in Beskrivning;
TextInput1_1.Text in Title;
Skapad = DatePicker1.SelectedDate; /* <-- DatePicker1 represents the DatePicker control in your app */
Status.Value = Dropdown1.Selected.Value
)

Or

Filter(
       'Underlag Kostnader';
       TextInput1.Text in Beskrivning;
       TextInput1_1.Text in Title;
       Text(Skapad, "mm/dd/yyyy") = Text(DatePicker1.SelectedDate, "mm/dd/yyyy");   /* <-- DatePicker1 represents the DatePicker control in your app */
       Status.Value = Dropdown1.Selected.Value
)

 

 

In addition, you could also consider take a try to achieve your needs using Search function as below:

Search(
Filter(
'Underlag Kostnader';
Status.Value = Dropdown5.Selected.Value;
Skapad = DatePicker1.SelectedDate;
);
TextInput1.Text; "Beskrivning"; "Title"
)

Or

Search(
       Filter(
              'Underlag Kostnader'; 
               Status.Value = Dropdown5.Selected.Value;
               Text(Skapad, "mm/dd/yyyy") = Text(DatePicker1.SelectedDate, "mm/dd/yyyy");
       ); 
       TextInput1.Text; "Beskrivning"; "Title"
)

More details about Filter functions in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

More details about Text function, please check the following article:

Text function

 

Best 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.
Highlighted
Oskarkuus
Level: Powered On

Re: Filter Gallery Combobox Choice with textinput or other combobox?

Great i ended up with something like this

 

SortByColumns(
    Search(
    Filter(
        'Underlag Kostnader';Status.Value = Dropdown5.Selected.Value;Text(Skapad; "[$-sv-SE]yyy/mm/dd") = Text
        (DatePicker1.SelectedDate; "[$-sv-SE]yyyy/mm/dd"))
    ;TextInput1.Text; "Beskrivning"; "Title")
;"Created";Descending)

This code works.

But i can not figure out how to add another textinput search.

This line:

;TextInput1.Text; "Beskrivning"; "Title")

Id rather have TextInput1.Text;"Beskrivning"; Textinput1_1;"Title")

 

And then regarding the dropdown5 control.

Now it have two options.

I realised i need a third option, something that looks for option 1 and option 2.

So i added this in the dropdown5 control items function

["Pending";"Klar";("")]

But that does not work very good.

 

 

 

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: 186 members 4,568 guests
Please welcome our newest community members: