I know we're throwing a lot of information at you here, so I'll go into detail and walk you through my recommended approach:
Step 1. Right click on the text field, and select "Customisers-->Custom Properties."
Step 2. Press the plus button and add a custom property called myStepNumber that is an integer datatype.
Step 3. Find the custom property for the text field at the bottom of the Vision Property Editor and click the binding icon:
Step 4. Select Tag at the top of the binding type selector on the left for a direct tag binding, and navigate to the tag in the folder tree on the right. Once the tag is selected, press the OK button to complete the binding.
Step 5. Right click on the text field, and select "Scripting."
Step 6. Select the propertyChange event handler, and write a simple script to update the text field anytime the step number changes:
# At run time, when the value of hte myStepNumber custom property changes,
# ...update the text field
if event.propertyName == 'myStepNumber' and event.newValue is not None:
defaultValue = 'Unknown Step'
# Create a Python dictionary of parameters to pass using the new value.
# Note that everything is CASE SENSITIVE, so capitalization matters.
# Make sure the capitalization is correct for this use case
parameters = {"mystepnumber" : event.newValue}
# Run the Named Query.
dataset = system.db.runNamedQuery("GetNextStep", parameters)
# Get the value for the current step number from the dataset,
# ...or use the default value if nothing is returned
if dataset.rowCount:
event.source.text = dataset.getValueAt(0, 'safety')
else:
event.source.text = defaultValue
This will work at all times in a running client session, but do not expect this to run outside of preview mode in the designer. In preview mode in the designer, this will only update if the tag changes value.





