web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Select DropDown Item o...
Power Apps
Answered

Select DropDown Item on Change of AnotherDropDown

(0) ShareShare
ReportReport
Posted on by 136

Hi Experts,

 

I'm trying to select a value in a Project Team Member dropdown whenever I change the value in a Project dropwdown.

 

I already have both dropdowns populated and what I wanted to achieve would look something like this in a pseudo code manner

 

ProjectTeamMember.OnChange => fx [Project.SelectedItem = First(ProjectTeamMember)]

 

Basically I have a list of projects and I want to select the first project team member everytime I change the project.

 

the365bit_0-1595521416383.png

 

Thank you

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,989 Moderator on at

    @the365bit 
    Yes, that's possible.

     

    To change the Project Team Member put this code in the Default property of its dropdown.  I assume project team member is also a ComboBox not a dropdown.

     

    LookUp(your_datasource_name, Project=ComboBox_Project.Selected.Project, 'Project Team Member')


    Then put this code in the OnChange property of the Project ComboBox to reset its partner to the Default value.

    Reset(ComboBox_ProjectTeamMember)


    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

  • the365bit Profile Picture
    136 on at

    Hi @mdevaney ,

     

    Thank you for the reply.

     

    But in this case if I use Lookup I'll be effectively performing another query in the database right? Because at the moment I already have a Filter(Source, Condition) in the Items property of my Project Team Member ComboBox.

  • TiagoFreire Profile Picture
    313 on at

    Yes, it requires another query, but a datasource can be a collection as well. 

    maybe the project db is too large to be loaded in a Collection, but accessory data like the list of users might be small enough to be Collect()ed, and you can lookup against that to save a server roundtrip. 

  • mdevaney Profile Picture
    29,989 Moderator on at

    @the365bit 
    Yes, you will be doing another 'query' in the database but I don't see why that matters.   There's not any performance or API usage issues here. 

     

    Can you please state your concerns?  I don't know what they are?

    Also, did you try the code?  No sense in talking about concerns if the code doesn't work.  Please implement it first.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

  • the365bit Profile Picture
    136 on at

    Hi @TiagoFreire , @mdevaney 

     

    Thank you for he answers.

     

    @mdevaney I did try the code but it didn't work as it is but your suggestion on using the Default property and Reset(Combo) helped me try other functions using these properties and I actually ended up with the following solution that it's now working:

     

    ProjectComboBox.Items= fx [ [@ProjectDataSource] ]

    ProjectTeamMemberComboBox.DefaultSelectedItems = Filter('Project Team Members', 'User'.'Email' = User().Email && 'Project'.'Id'= ProjectComboBox.Selected.Id)

    ProjectTeamMemberComboBox.Items = ""

    ProjectComboBox.OnChange(Reset(ProjectTeamMemberComboBox))

     

    Before I was doing this, the item that I wanted to auto select was there but wasn't default selected though.

     

    ProjectComboBox.Items= fx [ [@ProjectDataSource] ]

    ProjectTeamMemberComboBox.DefaultSelectedItems = ""

    ProjectTeamMemberComboBox.Items = Filter('Project Team Members', 'User'.'Email' = User().Email && 'Project'.'Id'= ProjectComboBox.Selected.Id)

     

    I mentioned the performance concerns as I believe no matter which platform we're working on if you can meet the requirement with one query why would you want to do more then one.

     

    Thank you again for the time on that guys.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard