OnChange is used to execute Formulas with Python™ scripts or LiveCode scripts when a value for a sub-inspection test changes after the sub-inspection page loads.
Also see Scripting in inspections
Contents [Hide] |
OnChange is intended to execute a script after an inspector modifies a sub-inspection. It only executes a script for a test when certain conditions are met for that test. Depending on the test type, there may be variations on when the OnChange event is executed.
Note: If a sub-inspection contains two Formula tests, one with the FormulaMode property set to Pre, and the other set to OnChange, the script set to Pre always executes first.
In PC Collect, Formula tests are executed with Python scripts.
The OnChange event executes when any of these conditions are met for a test:
Test: |
When the focus on this test is lost and the value for it changes:* |
When the value for it changes (but it has the focus):* |
When any of these specific conditions are met: |
— |
Yes |
— |
|
Yes |
— |
— |
|
Yes |
— |
— |
|
— |
Yes |
— |
|
Yes |
— |
|
|
— |
Yes |
— |
|
— |
Yes |
— |
|
— |
— |
|
|
Traceability (with EntryRestricted property set to False) DMS Event, SPC Event, SPC Cause, and SPC Action Taken do not trigger OnChange. |
Yes |
— |
— |
Traceability (with EntryRestricted property set to True) DMS Event, SPC Event, SPC Cause, and SPC Action Taken do not trigger OnChange. |
— |
Yes |
— |
When a user clicks or tabs to a test, that test has the focus until the user does one of these:
At that moment, the focus on that test has been "lost" – and if the value for that test has changed, the OnChange formula is triggered. |
The TestID property for sub-inspection tests is used by Python scripts in PC Collect to indicate which test in an inspection triggered an OnChange test formula.
In GS Collect, Formula tests are executed with LiveCode scripts.
The OnChange event executes when any of these conditions are met for a test:
Test |
When the focus on this test is lost and the value for it changes:* |
When the value for it changes (but it has the focus):* |
When any of these specific conditions are met: |
— |
Yes |
— |
|
Yes |
— |
— |
|
Yes |
— |
— |
|
Yes |
— |
— |
|
Yes |
— |
|
|
— |
Yes |
— |
|
— |
|
||
Yes |
— |
— |
|
When a user taps a test, that test has the focus until the user taps one of these:
At that moment, the focus on that test has been "lost" – and if the value for that test has changed, the OnChange formula is triggered. |