cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sahilauzim
Helper I
Helper I

Can 2 combo box depend on each other (interdependencies)

Combo box 1

sahilauzim_0-1669273778494.png

Combo box 2

sahilauzim_1-1669273872252.png

Item property of combo box 1 - Distinct(Equipments_List, alpha_)

Item property of combo box 2 - Distinct(Filter(Fruits_List, alpha_ = ComboBox1.Selected.Result), name)

I have been able to make the first combobox depend on the second combobox. I’m not able to make the second combobox depend on the first combobox.

Kindly help.

 

10 REPLIES 10
NurSabrina24
Helper III
Helper III

Hi @sahilauzim , 

 

Can you try to refer the solutions from this post?

Combo Boxes Depend on each other/Circural Reference . 

 

And see if through this post could solve your problems. If yes, please Accept as Solution. 

 

Thank you.

sahilauzim_0-1669292604800.png

I'm getting an error. It will be grateful if you can provide me a solution with an example. Thanks

NurSabrina24
Helper III
Helper III

Instead of putting the Distinct Filter functions in Items properties, can you copy and paste the same code to DefaultSelectedItems properties?

You can remove the code for OnChange properties. 

As combobox need Default selected items property to read for default selected.

 

Hope it helps. 

I have use another example.

I have paste the same code on DefaultSelectedItems. The unit number is working good. That is, it is dependent on the serial number. 

sahilauzim_2-1669381189885.png

The code I have used.

sahilauzim_3-1669381919905.png

But I'm not able to make the Serial Number to be dependent on the Unit Number.

 

Click your Serial Number combobox and see at its depends on..

NurSabrina24_0-1669687126946.png

Is it depends on to Unit Number combobox? If it is not, you can set it. 

 

Is it solved?

Drrickryp
Super User
Super User

@sahilauzim 

The trick to avoiding a circular reference with interdependent comboboxes is to use a collection of the selected items from each combobox using the combobox's OnChange property: ClearCollect(colserial,Self.SelectedItems)  for combobox1 and ClearCollect(colunit,Self.SelectedItems) for combobox2. Then set the Items properties of each combobox as follows:

For the Items property of Combobox1:

 

 

 

 

Sort(
    Distinct(
        Filter(
            Equipments_List,
            SerialNumber in colserial|| IsEmpty(colserial)
        ),
        'Unit Number'
    ),
    Result
)

 

 

 

 

and for the Items property of Combobox2:

 

 

 

 

Sort(
    Distinct(
        Filter(
            Equipments_List,
            UnitNumber in colunit || IsEmpty(colunit)
        ),
        SerialNumber
    ),
    Result
)​

 

 

 

 

You may need to correct the column names but hopefully you get the idea.

 

It is still not good. 

In my case, the 'unit number' is title as I have to use a unique column.  I have rename the column name

(1) For the serial  number on Items' property

sahilauzim_0-1669701261863.png

(2) For the unit number (which is title in my case) on Items' property

sahilauzim_1-1669701459512.png

 

 

I assume you have done the clearcollect for each combobox?

ClearCollect(colserial,Self.SelectedItems)  for combobox1 and ClearCollect(colunit,Self.SelectedItems) for combobox2

 

What is the error for colunit ya? And can you add bracket after Result, as you missed the end bracket. 

yes, I have done the clearCollect for each combobox.

The error is :

sahilauzim_0-1669705392909.png

Another issue, there is no data in the unit number combobox

sahilauzim_1-1669705532313.png

 

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,112)