Formula test

Note: Not all of the sub-inspection test toolbar buttons are technically "tests." For simplicity, that term is used to describe all of the sub-inspection test toolbar buttons.

The Formula test executes Python™ script (for PCs) or LiveCode (for iPads) to customize the inspection. Using this feature is recommended only for use by Hertzler Systems technical experts or others who are well-versed in programming methods and languages.

 

Contents  [Hide]

 

Adding a Formula test to a sub-inspection

  1. Click the Formula test toolbar button to add this test to the sub-inspection.

  2. Set any properties for this test on the Properties panel that displays after the test is added.

For information about using the Properties panel, see Changing property settings.

Formula test properties

Property

Default setting or default display

Allows

APPEARANCE

Label

[blank]

Enter text for a label and formula description.

BEHAVIOR

FormulaMode

Pre. Executes the formula before the operator can interact with the sub-inspection.

A Post formula is executed when the sub-inspection is submitted.

 

Click displays a button the inspector taps to run a formula. For this to properly function in GS Collect, the FormulaLocation property must be set to Local.

 

ClickToggle [PC only] also displays a button. When clicked, the script runs repeatedly until the inspector clicks the button again to finish running the script. This is especially useful in conjunction with the DataCanvas function.

  • While running, all sub-inspection controls except this button are disabled until the inspector clicks again to finish running the script, and any changes to the sub-inspection will be applied each time the end of the script is reached.

  • When the inspector clicks again to finish running the script, the special variable cancelrequested will be set to True and the current script will complete execution but not automatically run again.

 

An OnChange formula is executed when another test on that sub-inspection meets certain conditions. When the sub-inspection is submitted, the OnChange formula is also executed one last time before any Post formula (if one exists) is executed.

 

Cancel [PC only] executes the formula when the sub-inspection is cancelled (but before any final OnChange formula is executed). If the PC Collect module displays the warning message about unsaved data being lost, this formula will be executed after the user clicks Yes to exit.

MOBILE

FormulaLocation

[Mobile only]

Local. Uses the mobile device to execute the formula.

RunAtServer executes the formula using the server associated with the device.

SqlAtServer executes the formula using the server’s database. Updates and deletions are not tracked in the Audit Trail.

Also see FormulaMobile property.

FormulaMobile

[Mobile only]

[blank]

Enter LiveCode code or the SQL statement depending on the FormulaLocation property value.

Add a command line to run when the FormulaLocation property is set to RunAtServer.

You can double-click on the Formula test to edit the LiveCode code.

PC

PythonScript

[PC only]

[Blank]

Use the Python Script Editor to create, edit and debug a Python script.

You can double-click on the Formula test to edit the Python script or choose a different script.

RunningLabel

[PC only]

[Blank]

When the FormulaMode property is set to ClickToggle, this is the text to display on the button while the script is running.

If this is not set (left blank), the text in the Label property will be displayed while the script is running.

TestID

[PC only]

A unique TestID number is automatically assigned to each test in the inspection, but you can change this number to a more meaningful name.

The value of the TestID property in a Formula test is used when the FormulaMode property is set to Click.

See About the TestID property and testid Python variable.

VerticalSize

[PC only]

Regular. Test is full-sized.

Short. Helps you to fit more tests on the screen. Test may be shorter, and white space above and below this test may be reduced.

Related topic