You are currently reviewing an older revision of this page.
Property Watchers can be used to evaluate the value of one property to determine the value of a second property.
In this example, if the Date field is set to none via the Show None toggle, then PropA will be set to 3003, otherwise PropA is set to any value from the domain list.
To do this, PropA is defined as a comboBox with a series of values. This would be a typical combo box that you would create for your project.
In the ComboBox Properties, the default initial value is set to the value to be used when the Date field is empty. For our example, that's 3003.
For the Date property, the Show None option is enabled. This easily overlooked setting adds a tick box to the Date property. When toggled off, the Date field will be empty as shown in the Data Browser.
A property watcher is added to the Date with the following settings:
Name: A descriptive name
Type: SynchItem - This type of watcher is used to establish relationships between different feature properties. If a match value is provided, the current property’s value must equal this value for the watcher to execute.
Feature: The name of the feature that will be updated
Property: The name of the property of the feature to be updated
Value Type: cexpression
Redraw Watcher: On
Value To Set: (strlen("[MyBlock:Date]")>0) ? "[MyBlock:PropA]" : "3003"
This translates to If the Date property value length is greater than zero, then the PropA value is set to the current value of PropA. Otherwise the PropA value is set to “3003”.
The Date property value length is zero when the Show None toggle is OFF on the data time dialog item.
And, strlen returns the length of a string, that is, the number of characters.
Example: n = strlen(“hello world”) results in 11.
For more information, please refer to:
Expressions, Operators and Basic Functions
Attached is a sample schema that you can use for testing:
Property Watcher on empty value.zip