I’m trying to use a boolean runtime property “Edit mode” on my Database connected source to control if the object should be in edit mode (input fields enabled) or not. If “Edit mode” is true, I want to display a “Save” and “Cancel” button. If “Edit mode” is false, I want to display an “Edit” button.
As I want to control the edit possibilities for each object, I figured a runtime property would be the best. And as I don’t want the object to be in edit mode from the start, I’m setting “Value on create” to False.
However, when the app loads and the data source populates the runtime property isn’t set to any value. In my debugger, I see that the fields are left blank (no value). I’m unsure if this is a bug as the objects aren’t created, just retrieved from the database. And if that’s the case, I would love to request a feature that handles this. Some sort of “Initiate to” field.
While waiting for this to be fixed or featured, I can populate the fields, e.g., by updating the objects using On View Load. But this seems like an unnecessary extra step…
The Default value on a Runtime property on a Data Source is only set when an object is Created into that Data Source, not when data is read / filtered into it.
Which one is the case here?
PS: You may use the built-in Data Source property Object State in your condition to determine whether you are in “Edit mode” or “Create mode”. The object will have Object State
New when the object has never been saved,
Updated if it is an existing object with unsaved changes, or
Synchronized if it is an existing objects, but with no changes.
The objects aren’t created, just read from the database so, by what you’re writing, this is expected behavior.
Your suggestion of using Object State is a neat possibility, but in this case, I’m updating/editing objects without using a runtime data source. The updates are done directly to a database-connected data source.
I would love to request the ability to set runtime properties to an initial value when reading/filtering values from database-connected data sources.
We’ll discuss that one internally - if it’s conceptually ok and what it takes.
Another tip: you may use “Not Equals
true” instead of “Equals
false” in your conditions. That way, a property doesn’t need to be explicitely set to false. You just consider “everything else but
true instead of
Sounds good And thanx for the great tip – I’ll implement it right away