cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yjamous
Helper IV
Helper IV

Changing items in combo box based on selection in another combo box

Hi

I've two combo boxes. Both of them retrieve their contents from SP list.

POTypesDescription can be: Type 1, Type 2, Type 3, Type 4

 

Currently, this is what I have in Items property for each:

Combo Box 1 (the one that will control what shows in Combo Box 2):

 

 

Choices([@NoChargeRequests].POTypeDescription)

 

 

POTypesDescription data in SP: Type 1, Type 2, Type 3, Type 4

 

 

Combo Box 2 (items will depend on selection from Combo Box 1):

 

 

Choices(NoChargeRequests.ProductLines)

 

 

ProductLines data in SP: Product 1, Product 2, Product 3, Product 4, Product 5, Product 6, Product 7

 

So, what I want to do is that when the user choose POTypeDescription: Type 3, then to show in ProductLines Porduct 3 and Product 4 ONLY.

If you select ProductType Type1, Type2, Type4, Then you can see ONLY Product 1, Product 2, Product 5, Product 6, Product 7

The table below summarizes this:

POTypesDescription (Selected in dropdown)ProductLines (What to filter in the DropDown)
Type 3

Product 3, Product 4

Type 1, Type 2, Type 4

Product 1, Product 2, Product 5, Product 6, Product 7

 

I tried the following code for Items property for ProductLines, but when I used it, the selected value in ProductLines was not stored in SharePoint list when I did submitform.

 

 

If(DCValuePOTypeDescription.Selected.Value="Type 3",["Product 3", "Product 4"], ["Product 1", "Product 2", "Product 5" , "Product 6", "Product 7"])

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @yjamous ,

 

So your scenario is:

1\ When users select Type 3 in Combo box1, then they will only allow to select Product 3 or Product 4 from Combo box2.

 

2\ When users select other Types in Combo box1, they will allow to select Product 1, Product 2, Product 5, Product 6 or Product 7 from Combo box2.

 

Am I right?

 

If I'm right on the conjecture, the Combobox2.Items should be:

If(
   DCValuePOTypeDescription.Selected.Value="Type 3",
   Filter(Choices(NoChargeRequests.ProductLines), 
          Value in ["Product3","Product4"]
   ),
   Filter(Choices(NoChargeRequests.ProductLines), 
          Value in ["Product1","Product2","Product5","Product6","Product7"]
   )
)

 

The point is Choices type column are including records, not texts, so we need use Filter functions to get the corresponding records as selections and then the selected record could be updated to data source.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

4 REPLIES 4
v-jefferni
Community Support
Community Support

Hi @yjamous ,

 

Could you please share more details about your scenario?

 

According to your description, there are 4 selections of Types in Combobox1 and 7 products in Combobox2, the two combo boxes are both allowing multiple selections, so how did you restrict users from selecting in other ways? For example, if a user select Type 2 and Type 4 in Combobox1, what products will be auto selected in Combo box 2?

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Thanks @v-jefferni for getting back to me on this.

I've set the property of "SelectMultiple" to false. So, you can select ONLY 1 item.

But I can change this to dropdown, I don't require it to be combo box.

Hi @yjamous ,

 

So your scenario is:

1\ When users select Type 3 in Combo box1, then they will only allow to select Product 3 or Product 4 from Combo box2.

 

2\ When users select other Types in Combo box1, they will allow to select Product 1, Product 2, Product 5, Product 6 or Product 7 from Combo box2.

 

Am I right?

 

If I'm right on the conjecture, the Combobox2.Items should be:

If(
   DCValuePOTypeDescription.Selected.Value="Type 3",
   Filter(Choices(NoChargeRequests.ProductLines), 
          Value in ["Product3","Product4"]
   ),
   Filter(Choices(NoChargeRequests.ProductLines), 
          Value in ["Product1","Product2","Product5","Product6","Product7"]
   )
)

 

The point is Choices type column are including records, not texts, so we need use Filter functions to get the corresponding records as selections and then the selected record could be updated to data source.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Thanks @v-jefferni  This is EXACTLY what I wanted to achieve and it's working.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,518)