say I have 3 dropdown and 1 text field. I need to filter the data by these inputs.
if I do this code below, with && I get specific results, which I like, but this filters all the dropdowns regardless if they are blank/empty and does not provide good results. If I use && and populate all the inputs it works great giving me specific results. I tried || and this provides way too many results and they do not look accurate at all.
I tried doing If statements inside this code to like not search one of these if they are blank/empty, but I keep getting errors.
What is my best approach to exclude searches if those fields are empty. Should I be creating big If statements to provide the filter based on empty fields. cause that will be a very big nested if/else I would like to avoid...
SortByColumns(
Filter(
//Filter('PSI - PROJECTS', Dropdown_region.SelectedText.Value in region.Value || Dropdown_location.SelectedText.Value in location.Value || Dropdown_l1sponsor.SelectedText.Value in l1_sponsor.Value )
Filter('PSI - PROJECTS', Dropdown_location.SelectedText.Value in location.Value && Dropdown_l1sponsor.SelectedText.Value in l1_sponsor.Value && Dropdown_region.SelectedText.Value in region.Value)
,
search_title_code.Text in Title || search_title_code.Text in project_code || search_title_code.Text in acronym
),
"Title",
SortOrder.Descending
)