Click here to return to the KiXtart HelpDesk main page...

Expressions

KiXtart supports two types of expressions: string and numeric.

A string expression can consist of any combination of the following:

  • Literals (a sequence of characters enclosed in quotation marks)
  • Functions that return strings
  • Plus signs (+), which indicate concatenated sub-expressions

Numeric expressions can consist of any combination of:

  • Sub-expressions
  • Numeric literals
  • Numeric operators (+,  – , *, /, and so on)
  • Functions that return numeric literals

Both string and numeric expressions can contain the following conditional and logical operators:

  • <
  • >
  • =
  • <>
  • <=
  • >=
  • And
  • Or

An expression can contain up to 32,000 characters. Any variables, macros, or references to environment strings within an expression are resolved before the expression is evaluated and the return value is displayed.

Note

The characters @, %, or $ are normally used to indicate macros, environment strings, or variables. If you want to use these characters in a string, use @@, %%, or $$.

The following examples show the correct use of expressions in KiXtart:

$X = 1 + "20" ; $X type = integer / value = 21.
$X = "1" + "20" ; $X type = string / value = '120'.
$X = @USERID + "1" ; $X type = string / value = 'USER1'.
"Current time =  " + @time ; prints: "Current time = 12:34:00"
"Use @@time to print the time" ; prints: "Use @time to print the time "

$Y = "And this is how you access environment variables: %USERNAME%..."

IF @Day='Sunday' AND @USERID = 'RuudV'

$X = (@MONTHNO=3 AND @MDAYNO>=20) OR @MONTHNO=4

IF @WKSTA="VLEERBEER" OR @WKSTA="PALOMINE"

$X = ((@YDAYNO + 7) / 7) + 1

Strings in the script are displayed on the screen in the current character size starting from the current cursor position. For information about character size, see the BIG and SMALL commands.

A string can be enclosed in single or double quotation marks. To specify quotation marks in a string, either use the CHR function or enclose the entire string in the opposite type of quotation marks — .that is, if you want to include single quotation marks in a string, enclose the string in double quotation marks, and vice versa.

The following examples show the correct use of string expressions in KiXtart:

"Hi "+ @userid Hi RUUDV
'String with a double quote (") in it..' String with a double quote (") in it..
"String with a single quote (') in it.." String with a single quote (') in it...
"Another string with a double quote: " + Chr(34) Another string with a double quote: "

KiXtart determines the type of the expression from the first element of the expression.