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 / Interdependency betwee...
Power Apps
Unanswered

Interdependency between 2 multi-selection comboBoxes

(0) ShareShare
ReportReport
Posted on by 5

Hello PowerApps users! 

I'm currently a new user learning power apps and I wanted to implement a functionality that I will describe:

My datasource is a Sharepoint list. I have 2 multi-selection comboBoxes for the selection of primary skills (comboBox1) and secondary skills of a user (comboBox2). The choices available for selection in both these comboBoxes are the same and come from 2 choice columns within the Sharepoint List ('Primary Skills column' and 'Secondary Skills Column').

I want to create interdependency where the selected items in comboBox1 don't appear for selection in comboBox2 and vice-versa. Until now I only managed to make it one-way (comboBox2 is dependent of comboBox1). So in practical terms a user can't have the same skills as primary and secondary. 


My code for the items property of comboBox1:

  Sort(Choices([@TeamCatalog].'Primary Skills'),Value,SortOrder.Ascending)

 

My code for the items property of comboBox2: 

Sort(Filter(
 Choices([@TeamCatalog].'Secondary Skills'),
Not(Value in CP_DataCardPrimarySkills.SelectedItems.Value)
), Value, SortOrder.Ascending)

I'm always incurring in circular errors when trying it and tried using collections but couldn't implement it. Could you help me?

 

Thank you for your time!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,127 Most Valuable Professional on at

    Hi @JPereira ,

    You need to make a Collection OnChange of one of them with the Items you have on the other and use that as the Items of the other one.

     

    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

  • JPereira Profile Picture
    5 on at

    Hi @WarrenBelz
    Thank you for your input. With your help I was able to achieve the desired functionality (albeit maybe not so efficiently). 

    However, I've encountered a problem where every time a change has been made in any of the ComboBoxes, they automatically close (for example I select 1 item from the list and the comboBox closes, and to input another option I have to open the comboBox again).

    All the code that i've written is as follows:

     

    1. OnVisible property of the screen: ClearCollect(
    PrimarySkillsCollection,
    Sort(
    Choices([@SPList].'Primary Skills'),
    Value,
    SortOrder.Ascending
    )
    );
    ClearCollect(
    PrimarySkillsCollection,
    Sort(
    Choices([@SPList].'Primary Skills'),
    Value,
    SortOrder.Ascending
    )
    );
    ClearCollect(
    SecondarySkillsCollection,
    Sort(
    Choices([@SPList].'Secondary Skills'),
    Value,
    SortOrder.Ascending
    )
    );
    ClearCollect(
    SelectedPrimarySkills,
    CP_DataCardPrimarySkills.SelectedItems.Value
    );
    ClearCollect(
    SelectedSecondarySkills,
    CP_DataCardSecondarySkills.SelectedItems.Value
    )

    2. OnChange property comboBox1 (Primary skills): ClearCollect(
    SecondarySkillsCollection,
    If(
    IsEmpty(CP_DataCardPrimarySkills.SelectedItems),
    Choices([@SPList].'Secondary Skills'),
    Filter(
    Choices([@SPList].'Secondary Skills'),
    Not(Value in CP_DataCardPrimarySkills.SelectedItems.Value) && Not(Value in CP_DataCardSecondarySkills.SelectedItems.Value)
    )
    )
    );
    ClearCollect(
    SelectedPrimarySkills,
    Filter(
    Choices([@SPList].'Primary Skills'),
    Value in CP_DataCardPrimarySkills.SelectedItems.Value
    )
    );

    3. OnChange property comboBox2 (Secondary skills): ClearCollect(
    PrimarySkillsCollection,
    If(
    IsEmpty(CP_DataCardSecondarySkills.SelectedItems),
    Choices([@SPList].'Primary Skills'),
    Filter(
    Choices([@SPList].'Primary Skills'),
    Not(Value in CP_DataCardSecondarySkills.SelectedItems.Value) && Not(Value in CP_DataCardPrimarySkills.SelectedItems.Value)
    )
    )
    );
    ClearCollect(
    SelectedSecondarySkills,
    Filter(
    Choices([@SPList].'Secondary Skills'),
    Value in CP_DataCardSecondarySkills.SelectedItems.Value
    )
    );

    4. Items Property comboBox1: If(
    IsEmpty(PrimarySkillsCollection),
    Choices([@SPList].'Primary Skills'),
    Distinct(
    Filter(
    Choices([@SPList].'Primary Skills'),
    Not(Value in SelectedSecondarySkills.Value) || Value in SelectedPrimarySkills.Value
    ),
    Value
    )
    )

    5. Items property comboBox2: If(
    IsEmpty(SecondarySkillsCollection),
    Choices([@SPList].'Secondary Skills'),
    Distinct(
    Filter(
    Choices([@SPList].'Secondary Skills'),
    Not(Value in SelectedPrimarySkills.Value) || Value in SelectedSecondarySkills.Value
    ),
    Value
    )
    )

    DefaultSelectedItems property ComboBox1: If(
    IsEmpty(SelectedPrimarySkills),
    Parent.Default,
    SelectedPrimarySkills.Value
    )

    DefaultSelectedItems property ComboBox2: If(
    IsEmpty(SelectedSecondarySkills),
    Parent.Default,
    SelectedSecondarySkills.Value
    )

     

    Any help or suggestions as to what i'm doing wrong would be greatly appreciated!

     

     

     

  • WarrenBelz Profile Picture
    153,127 Most Valuable Professional on at

    @JPereira ,

    You only need the collection in one direction - you can base the other one directly. What do mean by "closing" - is it retaining the value ?

  • JPereira Profile Picture
    5 on at

    Yes, it retains the value (both in the collection and in the comboBox) but it closes the item list present in the comboBox as soon as I make a change. For example I want to select 2 skills at once and the comboBox loses focus after the first selection and I have to click it again to select the other one.

  • WarrenBelz Profile Picture
    153,127 Most Valuable Professional on at

    Hi @JPereira ,

    It is probably a result of having an action OnChange (it is not the normal behaviour), but unfortunately if you want the function posted, you will have to live with this.

     

    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

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 765 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 272

Last 30 days Overall leaderboard