Hi guys!
I'm reaching out to get some help with merging 2 different parts of code I have written. They work independently but I can't figure out a way to take the first code and merge it with the second.
Any help is very much appreciated!
1. First code, filtering the gallery with a combobox that displays Office 365 users
If(
IsEmpty(ComboBox2_5.SelectedItems);
lst_suivi_materiel;
Filter(
lst_suivi_materiel;
'Agent Propriétaire'.DisplayName in ComboBox2_5.SelectedItems.DisplayName)
)
2. Second code, that shows all the other filters for the gallery
Sort(//On trie par date dans l'ordre ascendant les résultats
Search(//on permet de rechercher grâce à "Search_IMEI.Text" le texte entré dans la liste
Filter(//ici on filtre la liste en affichant toujours au minimum tous les éléments, puis on trie par UO, type de matériel et agent
lst_suivi_materiel;
(IsBlank(Combo_UO_4.Selected.Value) || StartsWith(
UO;
Combo_UO_4.Selected.Value
)) && (IsBlank(Cat_Combo_2.Selected.Value) || StartsWith(
Type_de_materiel;
Cat_Combo_2.Selected.Value
)) && (IsBlank(Cat_Combo_3.Selected.Value) || StartsWith(
Disponibilité;
Cat_Combo_3.Selected.Value
))
);
Search_IMEI_1.Text;
"Title"
);
'Date de dotation';
SortOrder.Ascending
)
Thanks!
Hi again! Thanks for you answer, this solution wasn't working but I have figured out a way to make it work this is my final code for anyone encountering the same issue :
Sort(
Search(
Filter(
Datasource;
(IsBlank(ComboBox.Selected.Value) || StartsWith(
Column;
ComboBox.Selected.Value
)) && (IsBlank(ComboBox2.Selected.Value) || StartsWith(
Column;
ComboBox2.Selected.Value
)) && (IsBlank(ComboBox3.Selected.Value) || StartsWith(
Column;
ComboBox3.Selected.Value
)) && (IsBlank(ComboBox4.SelectedItems.DisplayName) ||
ColumnUser.DisplayName in ComboBox4.SelectedItems.DisplayName
)
);
SearchInput.Text;
"Title"
);
Column;
SortOrder.Ascending
)
@Anonymous ,
That is correct - the in filter is not Delegable, however the code I provided was simply copying the two elements of what you posted - if they worked for you, then the combined code should. If you want to improve the Delegation quality, you can do this
With(
{
wData:
Sort(
Filter(
lst_suivi_materiel;
(
Len(Combo_UO_4.Selected.Value) = 0 ||
StartsWith(
UO;
Combo_UO_4.Selected.Value
)
) &&
(
Len(Cat_Combo_2.Selected.Value) = 0 ||
StartsWith(
Type_de_materiel;
Cat_Combo_2.Selected.Value
)
) &&
(
Len(IsBlank(Cat_Combo_3.Selected.Value) = 0 ||
StartsWith(
Disponibilité;
Cat_Combo_3.Selected.Value
)
)
);
'Date de dotation'
)
};
Search(
Filter(
wData;
IsEmpty(ComboBox2_5.SelectedItems) ||
Agent Propriétaire'.DisplayName in ComboBox2_5.SelectedItems.DisplayName
);
Search_IMEI_1.Text;
"Title"
)
)
but you need to be aware that the record numbers out of the top With() statement need to be under your Delegation limit.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
Thank you for your answer!
I was using StartsWith because I am only using a ComboBox for the user research every other "Cat_Combo" is actually a dropdown.
Pasting your formula into the Items parameter of the Gallery I have "&&" ; "||" and "in" underlined in blue saying they don't work well on large databases. And also, when nothing is selected it still displays an empty gallery.
Hi @Anonymous ,
Try this - I am also wondering why you are using StartsWith on the Combo Boxes when it would usually be an exact match.
Sort(
Search(
Filter(
lst_suivi_materiel;
(
IsBlank(Combo_UO_4.Selected.Value) ||
StartsWith(
UO;
Combo_UO_4.Selected.Value
)
) &&
(
IsBlank(Cat_Combo_2.Selected.Value) ||
StartsWith(
Type_de_materiel;
Cat_Combo_2.Selected.Value
)
) &&
(
IsBlank(Cat_Combo_3.Selected.Value) ||
StartsWith(
Disponibilité;
Cat_Combo_3.Selected.Value
)
) &&
(
IsEmpty(ComboBox2_5.SelectedItems) ||
Agent Propriétaire'.DisplayName in ComboBox2_5.SelectedItems.DisplayName
)
);
Search_IMEI_1.Text;
"Title"
);
'Date de dotation';
SortOrder.Ascending
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
WarrenBelz
770
Most Valuable Professional
stampcoin
494
MS.Ragavendar
399