cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abhilashpmenon
Regular Visitor

Regarding Update in combobox in gallery going to infinite loop

I have a combo box in a gallery. I have 3 values in this combo box. I have uploaded 3 images to the app. I am then setting the images based on the values in the combo box.  It works properly when the app is loaded for the first time. It also works after I select the value. I am calling patch on the on change event. 

 

Switch(Text(ComboBox5.Selected.Value),"Meets",green,"Does Not Meet", red ,"Meets Partially", yellow )

 

green, red and yellow are my images.

 

However when I refresh the gallery, the combo box starts updating automatically. (it updates in infinite loop) 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @abhilashpmenon ,

Could you please share a bit more about the Patch formula that you typed within the OnChange property of the ComboBox?

 

Based on the issue that you mentioned, I think this issue is related to the OnChange property of the ComboBox. When you refresh your Gallery, these ComboBox in your Gallery would be reset, then the OnChange property of the ComboBox would be fired again.

 

I assume that you saved the ComboBox Selected option back to your data source (e.g. A SP List) through the Patch formula, is it right?

 

As an fixed solution, please consider take a try with the following workaround:

Set the DefaultSelectedItems property of the ComboBox5 to following:

{
   Value: ThisItem.Status.Value
}

Note: The Status column represents the Choice type column in your SP List to store ComboBox Selected option, please replace it with own column name.  If you use Text type column to store the ComboBox Selected option, please modify above formula as below:

{
   Value: ThisItem.Status
}

 

Set the OnChange property of the ComboBox to following:

If(
   ComboBox5.Selected.Value <> ThisItem.Status.Value,   // add a If conditon here to check if the ComboBox selection is changed manually
   Patch(....)  // Type your Patch formula here
)

If the Status column is a Text type column, please modify above formula as below:

If(
   ComboBox5.Selected.Value <> ThisItem.Status,   // add a If conditon here to check if the ComboBox selection is changed manually
   Patch(....)  // Type your Patch formula here
)

Note: I assume that the Gallery is connected to your data source.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Drrickryp
Super User II
Super User II

Hi @abhilashpmenon 

If I were doing the design, I would use a radio control instead of a combobox.  I have a screenshot that shows various properties of each control.  The radio control uses the Items property below it.  The Button in the middle has its Fill property set to the text inside. and the TextBox control has its Default property set to the same Switch() as the button. Likewise, you could have the your patch pick up the value in the Textbox and even hide the textbox if you wanted.Annotation 2020-05-25 122805.jpg

v-xida-msft
Community Support
Community Support

Hi @abhilashpmenon ,

Could you please share a bit more about the Patch formula that you typed within the OnChange property of the ComboBox?

 

Based on the issue that you mentioned, I think this issue is related to the OnChange property of the ComboBox. When you refresh your Gallery, these ComboBox in your Gallery would be reset, then the OnChange property of the ComboBox would be fired again.

 

I assume that you saved the ComboBox Selected option back to your data source (e.g. A SP List) through the Patch formula, is it right?

 

As an fixed solution, please consider take a try with the following workaround:

Set the DefaultSelectedItems property of the ComboBox5 to following:

{
   Value: ThisItem.Status.Value
}

Note: The Status column represents the Choice type column in your SP List to store ComboBox Selected option, please replace it with own column name.  If you use Text type column to store the ComboBox Selected option, please modify above formula as below:

{
   Value: ThisItem.Status
}

 

Set the OnChange property of the ComboBox to following:

If(
   ComboBox5.Selected.Value <> ThisItem.Status.Value,   // add a If conditon here to check if the ComboBox selection is changed manually
   Patch(....)  // Type your Patch formula here
)

If the Status column is a Text type column, please modify above formula as below:

If(
   ComboBox5.Selected.Value <> ThisItem.Status,   // add a If conditon here to check if the ComboBox selection is changed manually
   Patch(....)  // Type your Patch formula here
)

Note: I assume that the Gallery is connected to your data source.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (3,180)