cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SimonMeadows
Level 8

Gallery & Combobox OnChanged loop

Hi,

I have a gallery connected to an on-premise sql server datasource.

In the Gallery I have a combobox with its items source being another table in the sql database and, the default selected item being a lookup to the id of a field in the gallery.

This works, lists the items in the combo box, and shows the correct selected item for each record in the gallery.

The problem comes when I try to patch the sql table from the OnChanged property of the combobox.

I have the following e.g. on the OnChanged property of the combobox

Patch('SQL-Table', ThisItem, {MyFieldId:ComboBox.Selected.id})

Now, this also works and updates the table but then triggers a loop.

  1. OnSelect patches the table
  2. The change in the table triggers the gallery to reset
  3. All the fields in the gallery clear then set to the records of the table again
  4. The ComboBox sees the change from a selection to blank to selection and a change
  5. The ComboBox fires its OnChanged event
  6. The loop restarts

This loop continues until some timeout or loop counter internally to powerapps is reached then it stops.

No errors are shown but the gallery continues to reset and reload while the loop is in progress and no other controls in the gallery can be modified.

I have a feeling this is something to do with the delay in response to the datasource.

If I do the same to a collection, no loop occurs.

 

Any suggestions on how to stop it looping?

 

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,564)