Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Dynamic Dropdown not working

Posted on by 8

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.

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 143,591 on at
    Re: Dynamic Dropdown not working

    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

  • v-jefferni Profile Picture
    v-jefferni on at
    Re: Dynamic Dropdown not working

    Hi @mmbr1606 @mmbr1606 ,

     

    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,

     

     

  • mmbr1606 Profile Picture
    mmbr1606 9,998 on at
    Re: Dynamic Dropdown not working

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard