I always start by writing out my logic in plain terms. Then converting to code.
If I understand what you just said, only key members, that that match one of the records email entries, or is an admin, can use or apply the dropdown and search text. Is my understanding correct?
Assuming my assumption is correct, the first thing I would do I hide the dropdown and the search box if a user is NOT qualified to use them, or at a minimum disable them.
The other question is whether the search text and the dropdown can be used together or separate. I will assume separate for the moment.
So Here is what my logic would look like with the above assumptions:
Sort(
Filter(
'DL2 - Validations and DQ -Submissions',
And(
Or( // Is the user "special"? If this results in a False, nothing else will matter. Since
// the three Or() sections are wrapped in an And() each Or() section must result in a
// true in order for there to be a match.
'Created By'.Email = varUserEmail,
'Client Team Contact 1'.Email = varUserEmail,
'Client Team Contact 2'.Email = varUserEmail,
'Client Team Contact 3'.Email = varUserEmail,
'Transformation Doer Offshore'.Email = varUserEmail,
'Transformation Doer Onshore'.Email = varUserEmail,
'Transformation TR Offshore'.Email = varUserEmail,
'Transformation TR Onshore'.Email = varUserEmail,
UserAdmin
),
Or( // Only if the user is "special" does this even matter.
'Will the Data Level 2 Central Team implement the validations and data question or will the ongoing client team implement the validations and data question?'.Value = drpfilter.Selected.Value,
IsBlank( drpfilter.Selected )
),
Or( // Only if the user is "special" does this even matter.
StartsWith( 'Client Name', txtSearch.Text ),
IsBlank( txtSearch.Text ) // ** Important ** User may not enter search text and it should not throw off the results.
)
)
),
"Client Name",
Ascending
)
That should get the results you are looking for based on the assumptions made.
If the dropdown and search text are to be used together the filter changes slightly to the following:
Sort(
Filter(
'DL2 - Validations and DQ -Submissions',
And(
Or( // Is the user "special"? If this results in a False, nothing else will matter. Since
// the three Or() sections are wrapped in an And() each Or() section must result in a
// true in order for there to be a match.
'Created By'.Email = varUserEmail,
'Client Team Contact 1'.Email = varUserEmail,
'Client Team Contact 2'.Email = varUserEmail,
'Client Team Contact 3'.Email = varUserEmail,
'Transformation Doer Offshore'.Email = varUserEmail,
'Transformation Doer Onshore'.Email = varUserEmail,
'Transformation TR Offshore'.Email = varUserEmail,
'Transformation TR Onshore'.Email = varUserEmail,
UserAdmin
),
And( // If the dropdown and search text are to be used together.
Or( // Only if the user is "special" does this even matter.
'Will the Data Level 2 Central Team implement the validations and data question or will the ongoing client team implement the validations and data question?'.Value = drpfilter.Selected.Value,
IsBlank( drpfilter.Selected )
),
Or( // Only if the user is "special" does this even matter.
StartsWith( 'Client Name', txtSearch.Text ),
IsBlank( txtSearch.Text ) // ** Important ** User may not enter search text and it should not throw off the results.
)
)
)
),
"Client Name",
Ascending
)
I hope this provides some clarity. If my assumptions were incorrect please provide the logic rules of how you would like the match to work and I will give it another go.
Regards,
-S
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.