strTemplateVarInfo is used to enumerate over the variables found in the string template.
Input:
st: SYSHANDLE
A handle to the string template.
idx : INT(Default 0 )
The index of the variable to get information about.
Output:
name : STRING
The name of the variable.
Returns: INT
>0
|
- The number of times the variable is used in the template.
|
0
|
- Function is not supported.
|
-1
|
- Invalid handle.
|
-2
|
- Template is not ready.
|
-4
|
- Variable was not found.
|
Declaration:
FUNCTION strTemplateVarInfo;
VAR_INPUT
st : SYSHANDLE;
idx : INT;
name : ACCESS STRING;
END_VAR;
Example:
FUNCTION dump;
VAR_INPUT
st : SYSHANDLE;
END_VAR;
VAR
i : INT;
rc : INT;
name : STRING;
END_VAR;
i := 0;
DebugMsg(message:="Variables:");
rc := strTemplateVarInfo(st := st, idx := i, name := name);
DebugMsg(message:=" Idx Usage Name");
WHILE rc > 0 DO
DebugFmt(message := " [\1] \2 " + name, v1 := i, v2 := rc);
i := i + 1;
rc := strTemplateVarInfo(st := st, idx := i, name := name);
END_WHILE;
END_FUNCTION;
|