Contents [Hide] |
You can use some commands as arguments for other commands.
For example, the syntax for the IF command is
IF logical_test, True Part, False Part
If the logical_test should represent whether the operator clicked the Yes button or the No button in response to a question generated by your template, you can use the YESNO command to perform the logical test. The syntax for the YESNO command is
YESNO “text”, “optional _title”
Then you can combine these two commands so that the YESNO command is used as a part of the IF command:
IF ( YESNO “text”, “optional _title”), True Part, False Part
Filling in the rest of the parameters of this command might look something like this:
IF ( YESNO “Enter more data subgroups?”, “Continue?”), GOTO [C1], EXIT
When you combine commands that contain one or more arguments, it is prudent to use explicit parentheses to distinguish one command (and its arguments) from the other.
To add several commands to the formula line in one cell, place a colon (:) between distinct commands.
For example, to perform the SAVEROW and GOTO [C1] commands in the formula line of one template cell, that formula line should be:
SAVEROW : GOTO [C1]
Each cell is limited to a maximum 5,000 characters. If you need additional space, alternatives include:
-or-
Some commands use quotation marks to mark the beginning and end of a text string. For example, the syntax for the MESSAGE command is
MESSAGE "text"
You can use double-quotes (") or single-quotes (') to mark the beginning and end of the text string. However, you must use the same type of quotation mark to mark both ends of the text string.
If your text string contains a single quotation mark, you should use double quotation marks to mark the ends of the text string.
If your text string contains a double quotation mark, you should use single quotation marks to mark the ends of the text string.
All command names and cell references are case insensitive.
For example,
GOTO [C1]
is the same as
goto [c1]
The case of alphabetical characters matters only matters for the following situations:
Comparing text strings with commands like INSTR or PAR_S.
The contents of text strings that you display in a message to the operator, send to an RS-232 device, or write to a file.
SPC uses the following sequence to execute the formula on one cell of a template:
1. Execute the commands in the user formula in the order they appear, except for the following commands:
GOTO
SAVEALL or SAVEROW
EXIT
SHUTDOWN
SAVESS
CHAIN_T, CHAIN_P, or CHAIN_S
Components in formulas such as IF logical_test, True Part, False Part are also executed in the order they appear.
If the F8 key has been pressed, halt further template execution.
Evaluate Feedback formula(s) set for this row.
If the user formula contains a GOTO command, set this as the next cell. (Do not move to that cell now.)
If the builder formula contains a GOTO command, set this as the next cell. If the user formula also contains a GOTO command, the command in the builder formula overrides the one in the user formula. (Do not move to that cell now.)
Perform any SAVEROW or SAVEALL commands in the cell. If the cell contains both commands (i.e. one in the user formula and another in the builder formula), perform the SAVEALL command.
Perform any EXIT, SHUTDOWN, SAVESS, CHAIN_T, CHAIN_P, or CHAIN_S commands in the cell.
Go to the next cell set by the GOTO command in the user formula or the builder formula.
If neither formula contains a GOTO command, use the template setting or previous GODOWN and GOACROSS commands to determine the next cell, and go to that new cell.
When you combine values in one command or formula, it is helpful to use explicit parentheses to specify which values are meant to be used together.
Explicit parentheses in mathematical formulas
For example, the mathematical formula
ABS [C1] - 5
is ambiguous. Does it mean
( ABS [C1]) – 5 ?
Or does it mean
ABS ([C1] - 5) ?
It is helpful – both for you and for the template – to use parentheses to clarify how values are to be used. You could receive unexpected results from the first formula, while the second and third formulas will provide predictable results.
Explicit parentheses in nested commands
Explicit parentheses are also helpful when you nest commands inside other commands – particularly when both commands require additional arguments.
For example, the syntax for the IF command is
IF logical_test, True Part, False Part
and the syntax for the YESNO command is
YESNO “text”, “optional _title”
Notice that the third part of the YESNO command (“optional _title”) is optional, not required.
If you use the YESNO command as a part of the IF command, as in
IF YESNO “Enter more data subgroups?”, GOTO [C1], EXIT
Is GOTO [C1] a part of the YESNO command, or is it a part of the IF command? You could receive unexpected results from this formula.
The following example is not ambiguous about the syntax of both commands and will produce predictable results:
IF (YESNO “Enter more data subgroups?”), GOTO [C1], EXIT
SVARs can be used to create a variable cell reference.
For example, if you set the value of SVAR 1 = “A2” and then execute a command such as ‘GOTO [SVAR 1]’, the template will go to Cell A2.
The Syntax Checker verifies the syntax of all of the templates listed on the main screen of the Designer module. It can be a useful tool if templates stop working after upgrading to a newer version of GainSeeker SPC.
To launch the Syntax Checker from the main screen of the Designer module, click the Tools menu and select Syntax Checker.
You can create, modify, or delete templates while the Syntax Checker is running.
If any syntax errors are found, they will be displayed in an editor window.
This option is only available if you have access rights to "Send to Printer or Editor".