I have a PowerApp in which I have a form the form contains 3 dropdowns 1. Site 2. Team and 3. Assigned Person. Now based on the selected dropdown 1 and 2 (Site and Team) I have to filter assigned Person dropdown and if any one or both are missing then the default values i.e a collection( ColAllValues) should be displayed in the Assigned Person dropdown. How can I achieve this?
I added in the items property of Assigned Person Dropdown this code but it is not working:
If(
IsBlank(First(drpSite.SelectedItems)) && IsBlank(First(drpTeam.SelectedItems)),
SortByColumns(
Filter(
ColAllValues,
Urgent= If(
drpTrigger.Selected.Value = "Urgent",
true,
false
)
),
"Title",
SortOrder.Ascending
),
IsBlank(First(drpSite.SelectedItems)),
SortByColumns(
Filter(
ColAllValues,
Team in drpTeam.SelectedItems.Value,
Urgent= If(
drpTrigger.Selected.Value = "Urgent",
true,
false
)
),
"Title",
SortOrder.Ascending
),
IsBlank(First(drpTeam.SelectedItems)),
SortByColumns(
Filter(
ColAllValues,
Site in drpSite.SelectedItems.Value,
Urgent= If(
drpTrigger.Selected.Value = "Urgent",
true,
false
)
),
"Title",
SortOrder.Ascending
)
);
I also added this code on the Onchange of the dropdown 1 and 2 i.e. site and team and added it to a collection and on the items property of Assigned Person I added but this is also not working
If(Isblank(colFilteredAssignedPerson),colAllValues,colFilteredAssignedPerson)
Please help me how can I achieve it.
HI @kund14 ,
You should be able to condense it to this to
With(
{_Urgent: drpTrigger.Selected.Value = "Urgent"},
SortByColumns(
Filter(
ColAllValues,
(
Len(drpTeam.Selected.Value) = 0 ||
Team in drpTeam.SelectedItems
) &&
(
Len(drpSite.Selected.Value) = 0 ||
Site in drpSite.SelectedItems
) &&
(
Len(drpTrigger.Selected.Value) = 0 ||
Urgent = _Urgent
)
),
"Title",
SortOrder.Ascending
)
)
I assume you also want to allow for nothing being selected in the Urgent drop-down (so show all records)
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
The first condition is unnecessary:
SortByColumns(
Filter(
ColAllValues,
Urgent= If(drpTrigger.Selected.Value = "Urgent",true,false) &&
(IsEmpty(drpSite.SelectedItems)||Team in drpTeam.SelectedItems.Value) &&
(IsEmpty(drpTeam.SelectedItems)||Site in drpSite.SelectedItems.Value)
),
"Title",
SortOrder.Ascending
)
Best regards,
hey @kund14
can u try this:
If(
IsBlank(drpSite.Selected.Value) && IsBlank(drpTeam.Selected.Value),
ColAllValues, // Show all values if both Site and Team are not selected
Filter(
ColAllValues,
(IsBlank(drpSite.Selected.Value) || Site = drpSite.Selected.Value) &&
(IsBlank(drpTeam.Selected.Value) || Team = drpTeam.Selected.Value) &&
Urgent = If(drpTrigger.Selected.Value = "Urgent", true, false)
)
)
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.