OnChange

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.

When OnChange Formulas are executed in PC Collect

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:

Checkbox

Yes

Date/Time

Yes

Defects List

Yes

DMS Standard

Yes

Numeric Input

Yes

  • an SPC standard is selected

Pass/Fail/NA

Yes

Timer

  • user clicks Start

  • user clicks Stop

  • time remaining registers zero

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

*Lost focus:

When a user clicks or taps a test, that test has the focus until the user clicks on one of these:

  • another test

  • the Submit button

  • the Cancel button

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.

OnChange events and the TestID property

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.

When OnChange Formulas are executed in GS Collect

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:

Checkbox

Yes

Date/Time

Yes

Defects List

Yes

DMS Standard

Yes

Numeric Input

Yes

  • an SPC standard is selected

Pass/Fail/NA

Yes

Timer

  • timer starts

  • timer stops

  • time remaining registers zero

Traceability

Yes

*Lost focus:

When a user clicks or taps a test, that test has the focus until the user clicks on one of these:

  • another test

  • the Submit button

  • the Cancel button

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.