Hi all,
Hope you can help on the following;
My PowerApp can be used by everyone in our organization and it will display them all Distribution Lists we have out there.
The Gallery Items is currently set to:
If(IsBlank(SearchInput.Text),
Sort(Filter(DATASOURCE, OwnerEmail=User().Email), DisplayName, SortOrder.Ascending),
Sort(Filter(DATASOURCE, StartsWith(DisplayName,SearchInput.Text) || StartsWith(Manager,SearchInput.Text)), DisplayName, SortOrder.Ascending)
)
This is working fine and the way it currently work is:
- If the searchbar in my PowerApp is empty, it'll search for all Distribution Lists owned by that person using this piece of code:
Sort(Filter(DATASOURCE, OwnerEmail=User().Email), DisplayName, SortOrder.Ascending)​
- If the searchbar is not empty, it'll search my datasource for whatever was entered in the searchbar, using this piece of code:
Sort(Filter(DATASOURCE, StartsWith(DisplayName,SearchInput.Text) || StartsWith(Manager,SearchInput.Text)), DisplayName, SortOrder.Ascending)​
Some users don't own any Distribution Lists. What I'd like to add to my if statement is the following:
If column "OwnerEmail", in my datasource is empty and the searchbar is empty as well then display all Items in my datasource (so basically remove all the filtering I use today).
The end goal would be 3 different filterings for my Gallery Items:
- If column "OwnerEmail" in my datasource is not empty, but the searchbar is empty, do this:
Sort(Filter(DATASOURCE, OwnerEmail=User().Email), DisplayName, SortOrder.Ascending) - If the Searchbar in my Powerapp is not empty, do this:
Sort(Filter(DATASOURCE, StartsWith(DisplayName,SearchInput.Text) || StartsWith(Manager,SearchInput.Text)), DisplayName, SortOrder.Ascending) - (NEW to add) If OwnerEmail in my datasource is empty and the searchbar is empty, do this: Display ALL items of my datasource. Example code:
Sort(DATASOURCE, DisplayName, SortOrder.Ascending)
How do I make this work?