Hi,
i am having a gallery which i need to filter based on a selection from a combobox (single selection), and keep the search function on the results, here is the formula:
Filter(Search(Doctors, TextInput6.Text,"DoctorName"), City=ComboBox2.Selected.Value)
so on this formula we have 3 scinarios:
1. the user use the filter only, and result as expected the records will be filtered by City (even if the user did not make a selection, the gallery will remain blank)
2. the user search by text, and the gallery displays the results with no problem.
3. (here is the problem), when the user select a city, then enter text to find the doctor inside that city the results shown are from all cities, which means the filter is not working while the search is working!!
i tried to invert the formula (filter is inside the filter) with the same results.
so I need to retain the filter and search on the results of the filter.
appreciate your advice.
Mohammad
Hi,
please comment, or advise on my issue.
thanks
Moahammad
Hi @mokhawaja
Try to use this formula, I tested it on Test SharePoint List and it filters like you want.
Gallery.Items: If( CountRows(ComboBox2.SelectedItems) > 0 && !IsBlank(TextInput6.Text), Filter( Doctors, City in ComboBox2.SelectedItems.Value, StartsWith(Title,TextInput6.Text) ), CountRows(ComboBox2.SelectedItems) > 0, Filter( Doctors, City in ComboBox2.SelectedItems.Value ), !IsBlank(TextInput6.Text), Filter( Doctors, StartsWith(Title,TextInput6.Text) ), Doctors )
thanks @Anonymous for your reply... it worked with limited functionalty, unfortunately my datasourse is CDS and startswith function is non delegable on CDS!!
actually i beleive my function should work fine, but i think there is some kind of a bug or something.
thanks,
Mohammad
I managed to find a solution for this problem, in which i used Collections.
So for the first level of filteration:
ClearCollect(nameofCollectionvar,Filter(tablename,field1=value1 && field2= value2));
you will then use the same collection you generated above for the below search
Search(nameofCollectionvar,textfield.txt,"field3","field4"))
hope this works for you
Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.
Did you miss the call?? Check out the Power Apps Community Call here!
User | Count |
---|---|
268 | |
209 | |
76 | |
43 | |
35 |
User | Count |
---|---|
347 | |
225 | |
118 | |
72 | |
54 |