Miscellaneous Functions

CreateObject

Description

Creates and returns a reference to an object.

Syntax

  • CreateObject(typename [, location])

Arguments

  • typename
    • The type or class of the object to create.
  • location
    • Optional. The name of the network server where the object is to be created.

EncryptString

Description

Encrypts any string.

Syntax

  • EncryptString

Arguments

  • string
    • The string to be encrypted.

GetLocale

Description

Returns the current locale ID value.

A locale is a set of user preference information related to the user's language, country/region, and cultural conventions.

The locale determines such things as keyboard layout, alphabetical sort order, and date, time, number, and currency formats.

Syntax

  • GetLocale

Arguments

  • None

GetObject

Description

Returns a reference to an object from a file.

Syntax

  • GetObject([pathname] [, class])

Arguments

  • pathname
    • Optional. Full path and name of the file containing the object to retrieve. If pathname is omitted, class is required.
  • class
    • Optional string being the class of the object.

GetRegisteredValue

Description

Retrieves a value previously saved with RegisterValue. If no matching key is found an empty string is returned.

Syntax

  • GetRegisteredValue(key)

Arguments

  • key
    • Value used to address or store the value. The key value may be either a single value or an array of values.

IIf

Description

An inline if statement, returning one of two values, depending on the evaluation of an expression.

Both the truepart and falsepart are eagerly evaluated. This means they are evaluated irrespective of the expression result.

Use a traditional "if then else statement" if you require the truepart or falsepart to be evaluated only on the result of the condition.

Syntax

  • IIf( expression, truepart, falsepart )

Arguments

  • expression
    • Any valid Boolean expression.
  • truepart
    • Returned when expression evaluates to True.
  • falsepart
    • Returned when expression evaluates to False.

Example

Return "Turtle" when the Customer field has a value of ABC001 otherwise return "Horse".

IIf(%Customer = "ABC001", "Turtle", "Horse")

Multiply the Price field with either 1, when the Qty field is less than 1, otherwise for all values of Qty where the multiply the Price field with the Qty field.

%Price * IIf(%Qty < 0, 1, %Qty)

Return HARDWARE if the EquipmentType field is empty, otherwise return the value from the PRODUCTCODE lookup. Since IIf function eagerly evaluates, the Lookup method will always be evaluated. This may present an issue if the Lookup would raise an error on an empty value (as would happen here).

IIf(%EquipmentType = "", "HARDWARE", Lookup("PRODUCTCODE", "LKUPRESULT", %EquipmentType, True))

IsEmpty

Description

Returns a Boolean value indicating whether a variable has been initialized.

Syntax

  • IsEmpty(expression)

Arguments

  • expression
    • Can be any expression. However, because IsEmpty is used to determine if individual variables are initialized, the expression argument is most often a single variable name.

IsNull

Description

Returns a Boolean value that indicates whether an expression contains no valid data (Null).

Syntax

  • IsNull(expression)

Arguments

  • expression
    • Can be any expression.

IsObject

Description

Returns a Boolean value indicating whether an expression references a valid object.

Syntax

  • IsObject(expression)

Arguments

  • expression
    • Can be any expression.

RegisterValue

Description

Stores a value which is persisted during a single transform by its key. The function is used in conjunction with GetRegisteredValue to retrieve the stored value.

Syntax

  • RegisterValue(key, value)

Arguments

  • key
    • The value used to address or store the value. The key value may be either a single value or an array of values.
  • value
    • The value to store.

SetLocale

Description

Sets the global locale and returns the previous locale.

Syntax

  • SetLocale(lcid)

Arguments

  • lcid
    • Any valid 32-bit value or short string that uniquely identifies a geographical locale. Recognized values can be found in the Locale ID chart.
    • If lcid is zero, the locale is set to match the current system setting.

TypeName

Description

Returns a string that provides Variant subtype information about a variable.

Syntax

  • TypeName(varname)

Arguments

  • varname
    • Any variable.

VarType

Description

Returns a value indicating the subtype of a variable.

Syntax

  • VarType(varname)

Arguments

  • varname
    • Any variable.

WriteToLog

Description

Writes an entry to the detail area of the log.

Syntax

  • WriteToLog code, message

Arguments

Note this is a procedure (or sub) and there should NOT be any parentheses placed around the arguments.

  • code
    • The number or code to be written to the ResultCode field of the log.
  • message
    • The message to be written to the ResultReason field of the log.