$ObjCreate

Creates the named ActiveX object.

Syntax

$ObjCreate (ProgId)

Parameters

ProgIda string or an expression that evaluates to a string

Return Value

Returns an object that can be assigned to a variable of type object.

Comments

An ActiveX or COM object is identified by a GUID (a globally unique number). A ProgId identifies a COM object with a meaningful name. It looks like vendor.component.version or vendor.component.

When you assign to an Object variable using $ObjCreate, the existing COM object referenced by the Object variable (if any) is released.

Before your program terminates, it’s a good idea to set any Object variables to $Null, so that the objects your program used can be released.  Otherwise, even after your program terminates, because the Zim variables still exist and still reference the COM objects you used, the objects will still be active and consuming memory and resources.

This does not apply to the OLE control form variable, since when the form is closed the OLE control is automatically released, but it does apply to any objects returned from an OLE control via $ ObjRunMethod or $ ObjGetProperty.

Warning

COM objects are being discontinued by Microsoft and may not be available in future releases of Zim-X.

$todate

Converts an expression to the date data type.

Syntax

$todate(expression)

Parameters

expressionAny expression. To be meaningful, it should yield a number that has meaning in the format YYYYMMDD.

Return Value

Date.

Example

$date - $todate(19980923)

In the preceding arithmetic expression, 19980923 is treated as the date 23 September 1998 instead of the number 19,980,923. Assuming that $Date is 19981023, the expression evaluates to 30.

See Also

$toalpha

$tocharacter

$tonumber

$ltrim

Trims leading blanks from a character string.

Syntax

$ltrim(string)

Parameters

stringa character string or an expression that evaluates to a character string

Return Value

Character string.

Comments

Use $ltrim to remove leading spaces from a character string.

For output purposes, the implicit length of the result returned by $ltrim is the same as the length of string.

Example

$ltrim(Salary)

Evaluates to “20000” if Salary is 20,000 (INT data type).

See Also

$trim

$ttrim

$trim

Trims leading and trailing blanks from a character string in a field.

Syntax

$trim(string)

Parameters

stringa character string, or any expression that evaluates to a character string

Return Value

Character string.

Comments

Use $trim to remove leading and trailing spaces from a character string in a field.

For output purposes, the implicit length of the result returned by $trim is the same as the length of string.

Example

$trim(LastName)

Evaluates to “Smith” if LastName is stored as ” Smith “.

See Also

$ltrim

$ttrim

$adddays

Calculates a date value by adding days to (or subtracting days from) from a specified date value.

Syntax

$adddays(date,number)

where

datea date, or an expression that evaluates to a DATE data type
numbera number, or an expression that evaluates to a number

Return Value

Number, representing a DATE value.

Comments

Use $adddays to perform arithmetic with date values. $Adddays calculates a date value by adding a number representing days to a date value. If number is negative, the effect is to subtract the days from the date.

The + (add) and – (subtract) operators can be used to achieve the same results.

If date or the result of the functional expression is an invalid date (e.g., 19930231), it is adjusted to produce a valid date (e.g., 19930228).

Example

If $Date has the value 19981225, then

$adddays($date,5)

Evaluates to 19981230.

$adddays($date,7)

Evaluates to 19990101.

$adddays($date,-5)

Evaluates to 19981220.

$adddays(19990201,30)

Evaluates to 19990303.

$atan

Calculates the arctangent of a number.

Syntax

$atan(number)

Parameters

numbera number, or an expression that evaluates to a number

Return Value

Number, with the same number of decimal places as number.

Comments

Use $atan to calculate the arctangent (in radians) of a number. The value returned by this function has the same number of decimal places as number.

Example

let vAngle[1] = $atan(0.500)

The preceding command sets the first element of array variable vAngle to 0.464.

See Also

$acos

$atan2

$tan

$tanh

About Functional Expressions

$fileprint

Prints a text or bitmap file.

Syntax

$fileprint(filename[,filetype])

Parameters

filenamea character string or an expression that evaluates to a character string
filetypea number that determines if the file is a text file (0) or a bitmap file (1)

Return Value

The $fileprint function returns “1” ($True) if no errors were detected before the print job was submitted. Otherwise, it returns “0” ($False).

Comments

Bitmap printing is available only in the Windows environment.

$filepath

$filepath

Returns the path of the disk file associated with a specified object.

Syntax

$filepath(objname)

Parameters

objnameThe name of an EntitySet, relationship, application directory, or application document.

Return Value

The $filepath function returns a character string containing the path to the disk file that contains the specified object. AREAS.ZIM or DIRS.ZIM entries that apply to the file are expanded, as are the special path indicator characters. The value of $filepath is dynamically set, unless the program is compiled. Once a program is compiled, this value cannot be changed.

See Also

$ClipPath

$DBPath

$filenum

$ImagePath

$WorkPath

$ZimPath

$truncate

Truncates a decimal number, making it an integer.

Syntax

$truncate(number)

Parameters

numbera number, or an expression that evaluates to a number

Return Value

Number, with no decimal places.

Example

$truncate(2.49)

Evaluates to 2.

$truncate(2.99)

Evaluates to 2.

int1 - $truncate(int1/int2) * int2

Performs int1 modulo int2. Can also be expressed as $modulus(int1,int2).

See Also

$modulus

$round

$tonumber

$ttrim

Trims trailing blanks from a character string.

Syntax

$ttrim(string)

Parameters

stringa character string, or any expression that evaluates to a character string

Return Value

Character string.

Comments

Use $ttrim to remove trailing spaces from a character string.

For output purposes, the implicit length of the result returned by $ttrim is the same as the length of string.

Example

$ttrim (LastName)

Evaluates to “Smith” if LastName is stored as “Smith “.

detail line $concat($ttrim(LastName),", ",FirstName)

Displays a last name first in a report.

See Also

$ltrim

pt_BRPortuguese