Does the drop down always fire property change events when loading a project in the Client?

Hey all,

I am trying to find out what's going on with my drop down lists. I have their selected values (labels in one case) bound to a named query. Everything works fine until I save the project. The client reloads, and it seems that the selectedLabel property change event fires and updates the database with incorrect values.

The propertyChange script checks for this property:

if event.propertyName == 'selectedLabel':
	newValue = event.source.selectedLabel

and if the property changes when a user updates the selection, it will fire an update query. But it fires every time the client reloads!

This drop down's data is bound to a single column list from a DB table.

SELECT [SerialNumber]
FROM [temp].[Lids_Metal_Oamb]
WHERE [Oamb] = 1

The Selected Label is bound to a query that finds the last updated value from a DB table. So, when the screen loads, each drop down should be populated with the correct value from the DB.

SELECT SerialNumber 
FROM [temp].[Oamb_Location]
WHERE OL_ID = 2

Notes:
I am using Lenient selection mode.
I am not actively using/binding anything to the No Selection properties, as each drop down should display an actual value.
Lastly, when the script fires on the client reload, the values that get entered into the DB are: <Select One>, which is the value of the No Selection Label.

The questions are:
What are the drop down list boxes doing, or maybe why are they firing the property change event on the selectedLabel when the client loads?
How can I prevent them from firing when the client loads, and is this what I need to do?

Thank you!

You cannot. The selected label cannot be determined before the options are loaded, and there is always a small window between startup and data arrival for query bindings.

Your UI flow is broken--there should be a save button or some other operation that actually writes to the DB, and that button should be disabled when there's no valid data to save, and when the current selection matches the last saved DB value.

(I usually style data entry components as yellow when unsaved changes are present, too.)

1 Like