The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



ExtractionCommands


Unit:SDL_math2
Class:TExtractor
Declaration:property ExtractionCommands: string;

The property ExtractionCommands contains the commands which have to be applied to the source string.

In general, each command has the same structure: the command is followed by the required parameters enclosed in parentheses and finished by a semicolon. Commands must not be nested (i.e. a command cannot be called from within another command). If a command creates a variable, the variable is created automatically without explicit declaration. Variables are always variants.

Commands starting with a hash character (#) are treated as comments. Do not forget to close a comment with a semicolon, otherwise the next command will be interpreted as comment and ignored.

Command Description
assign(destvar=value) Assigns the value (which may be either a numeric value or a string) to the variable destvar. String values have to be enclosed in single quotes. The variable identifier destvar may be any string starting with a character and containing only characters and digits. The variable identifier must not use reserved words of the class TMathExpression (i.e. any function names).
calc(destvar=expr) Calculates the arithmetic/logic expression expr and stores the result in the variable destvar. The variable identifier destvar may be any string starting with a character and containing only characters and digits. The variable identifier must not use reserved words of the class TMathExpression (i.e. any function names). The expression expr has to comply with the rules of TMathExpression. The expression may contain any number of variables previously created by commands such as copy, or calc.
copy(n,destvar) Copies n characters from the current execution pointer to the variable destvar. The execution pointer is advanced by n characters after the command. The variable identifier destvar may be any string starting with a character and containing only characters and digits. The variable identifier must not use reserved words of the class TMathExpression (i.e. any function names).
copyuntil('str',destvar) Copies all characters between the current execution pointer and the position of the substring 'str' to the variable destvar (the substring itself is not copied). The execution pointer is advanced to the first character after the substring 'str'. If 'str' is not contained in the source string, the entire rest of the source string is copied. The variable identifier destvar may be any string starting with a character and containing only characters and digits. The variable identifier must not use reserved words of the class TMathExpression (i.e. any function names).
emit(id=expr:vartype) Calculates the arithmetic/logic expression expr and assigns it to the identifier id. The calculated value is passed to the application program by triggering the event OnEmit. The id may be any combination of letters and digits, the expression expr has to comply with the rules of TMathExpression. The expression may contain any number of variables previously created by commands such as copy, or calc.

The optional type declaration :vartype can be used to pass on an additional type information. The type declaration may assume one of the following values: etDefault, etDouble, etInteger, etBoolean, etString, etDatetime, etUser1, and etUser2. The type etUser1 and etUser2 can be used to indicate special types whose exact definition depends on the particular application. If no type declaration is specified, the type etDefault is used automatically. Please note that this type declaration does not affect the variant output variable id, it is only used to pass information to the OnEmit event handler.

exiton (varname) Stops the extraction script if the variable varname is TRUE. In this case the Execute command returns a FALSE value.
find(n,'str') Positions the execution pointer to the n-th occurrence of the string str starting at the position of the current execution pointer. If str cannot be found the execution pointer is left unchanged. The find command is not case-sensitive.
inc(dx) Moves the execution pointer by dx characters. dx may be negative or positive. If the value of dx results in a execution pointer which is beyond the limits of the source string, the execution pointer is restricted to the beginning or end of the source string (whatever is closer).
makelc(varname) Converts the contents of variable varname to lower case letters. The command makelc has no effect if applied to numeric data. makelc may be used to convert the entire source string to lower case characters by using the special variable name $sourcestring.
makeuc(varname) Converts the contents of variable varname to upper case letters. The command makeuc has no effect if applied to numeric data. makeuc may be used to convert the entire source string to upper case characters by using the special variable name $sourcestring.
pos(x) Positions the execution pointer to the character at position x. If x is less than or equal to 1 the execution pointer is set to the beginning of the source string, if x is greater than the length of the source string, the execution pointer is set to the last character of the string.
scandatetime('fmt',destvar) Scans the source string starting at the current execution pointer for a date/time string using the format specifier fmt. The format specifier uses the same syntax as the ScanDateTime routine. The result is stored in the variable destvar. Please note that the command scandatetime does not change the execution pointer (in contrast to several other commands). The variable identifier destvar may be any string starting with a character and containing only characters and digits. The variable identifier must not use reserved words of the class TMathExpression (i.e. any function names).
strcomp(destvar= srcvar,'str') Compares the contents of the variable srcvar to the string str and stores the result in the variable destvar. The comparison is case-sensitive. Please note that the result can be used both as a boolean variable (TRUE or FALSE) or as an arithmetic variable (-1 or 0).


Last Update: 2012-Oct-20