$setproperty

Changes the settings of certain device properties of the registry variables file.

Syntax

$setproperty(section, property, newsetting)

Parameters

sectionA character string or an expression that evaluates to a character string to indicate the group of properties or registry values that should be changed.
propertyA character string or an expression that evaluates to a character string to name the property or register that should be changed.
newsettingA character string or an expression that evaluates to a character string containing the new value for the property or register value.

Return Value

A character string containing “1” ($True) if the arguments to the function were valid and newsetting was applied. Otherwise, it returns “0” ($False).

Comments

If more than one $setproperty is used during the generation of a report, then only the last $setproperty is in effect when the report is printed.

Care should be taken when changing the setting of registry values, as improper manipulation can result in program or system failure.

The following are possible values for section, property and their corresponding newsetting:

“DESKTOP”Changes properties of Zim desktop.
property and newsettingThe only possible value for a desktop property is “ScreenUnits” which accepts the following newsetting:0 = screen units are pixels;
1 = screen units are twips;
2 = screen units are points;
3 = screen units are logical inches;
“PRINTER”Sets printer properties of the default printer.
property and newsettingPossible values for a printer property and corresponding newsetting are:”Color” or “Colour” = 1, Monochrome; 2, color;
“Copies” = number of copies;
“DisplayPrintDialog” = 0 or 1, prints the dialog; 2, doesn’t print it;
“Duplex” = 1, Simplex; 2, Vertical; 3, Horizontal;
“FontName” = a valid font name;
“FontSize” = a valid font size;
“MonospacedFont” = 0 or 1, uses mono-spaced fonts; 2, doesn’t use it;
“Orientation” = 1 for Portrait and 2 for Landscape;
“PaperBin” = a number indicating the paper bin (see the printer manual);
“PaperLength” = a number to indicate the paper length (see the printer manual);
“PaperSize” = a number to indicate the paper size (see the printer manual);
“PaperWidth” = a number to indicate the paper width (see the printer manual);
“PrintQuality” = a number indicating the printing quality (see the printer manual);
“Reset” = any value resets to the default values (the value is ignored);
“Scale” = a number indicating the scale to be used for printing;
“TrueTypeOption” = 1, bitmap; 2, download; 3, substitute; 4, outline;
“YResolution” = a number indicating the Y resolution.
“SESSION”Sets properties for the current session of Zim.
property and newsettingPossible values for the Zim session property and the corresponding newsetting are the ones described in the Zim configuration options for the current database. See Zim Database Configuration File (zimconfig.zim) for further details.
“REG:[sub-section]” or “INI:[sub-section]”Sets any properties of this user-defined sub-section.
property and newsettingproperty and newsetting can have any values because they are user-defined.

“SESSION”:

“REG:[ODBC]”To programmatically create an ODBC data source connection.
property and newsettingPossible values for the ODBC Driver data source property and the corresponding newsetting are:The data source name = must be $getproperty(“REG:[ODBC]”, “VERSION”);
“DBQ” = the database name to connect to;
“Driver” = must be $getproperty(“REG:[ODBC]”, “DRIVER”);
“DSN NAME” = the name of the data source;
“Host” = the address of the machine running Zim Server;
“PWD” = the password of the connecting user;
“Server” = the port number that Zim Server is listening to;
“UID” = user name identification;
“WorkPath” = work path of the current session.

For more information, see Configuring a Data Source.

If running the Zim executable, the section “REG:[…]” sets the registry values in the machine where Zim Server is running because Zim only runs in the same machine as Zim Server runs.

If running the Zim Thin executable, the section “REG:[…]” sets the registry values in the machine where Zim Thin is running.

In order to set registry values in the machine where Zim Server is running when running Zim Thin, you must use the section “SERVREG:[…]” which has the same meaning and syntax as “REG:[…]”.

Examples

let vSet = $setproperty ("printer", "fontsize", "12")

Sets the font size of the default printer to 12.

let vSet = $setproperty ("REG:[MYSET]", "My Setting", "I like this one.")

Sets “I like this one.” in the property “My Setting” belonging to the sub-section “MYSET”. This kind of setting is useful for applications to keep track of values used in the Zim application.

let vSet = $setproperty ("SESSION", "Parameter Size", "2000")

Sets the database configuration option “Parameter Size” to 2000.

See Also

$getproperty
$printersetup

$year

Extracts the year number associated with a specified date value.

Syntax

$year(date)

Parameters

datea data, or an expression that evaluates to a date, in the form YYYYMMDD

Return Value

Character string.

Comments

This function extracts day information from standard date values. Date is often the system variable $Date.

Example

$year(19981225)

Evaluates to “1998”.

$year($date + 7)

Evaluates to “1999” when $Date is 19991225.

See Also

$addyears

$Date

$day

$dayname

$month

$monthname

$weekday

About Data Types

About Functional Expressions

$iszimname

Tests if a character string is a valid object name.

Syntax

$iszimname(string)

Parameters

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

Return Value

1-character binary string. Evaluates to 1 ($True) if string meets the validation test; otherwise, evaluates to 0 ($False).

Comments

This function tests if a particular character string is valid zim object name.

Example

$iszimname(189)

Evaluates to $False.

$iszimname("Fields")

Evaluates to $True.

See Also

$isalphabetic

$isalphanumeric

$isdate

$isdigit

$islower

$isnumber

$isupper

About Character Literals

About Functional Expressions

$weekday

Determines the day-of-the-week number associated with a specified date value.

Syntax

$weekday(date)

Parameters

datea date, or an expression that evaluates to a date, in the form YYYYMMDD

Return Value

Character string.

Comments

This function extracts day information from standard date values. Date is often the system variable $Date.

Example

$weekday(19981225)

Evaluates to “7”.

$weekday($date+7)

Evaluates to “7” when $Date is 19981225.

See Also

$addmonths

$Date

$day

$dayname

$month

$monthname

$year

About Data Types

About Functional Expressions

$isnumber

Tests if an expression produces a valid number after its evaluation.

Syntax

$isnumber(expression)

Parameters

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

Return Value

Returns 1 ($True) if string meets the validation test; otherwise, returns 0 ($False).

Example

$isnumber(2+3)
$isnumber($trim("  3.5"))

Evaluates to $True.

$isnumber($trim(LastName))

Evaluates to $False.

See Also

$isalphabetic

$isalphanumeric

$isdate

$isdigit

$islower

$isupper

$iszimname

About Character Literals

About Functional Expressions

$toord

Converts a character into its ordinal number value.

Syntax

$toord(char)

Parameters

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

Return Value

Number.

Comments

Each of the decimal numbers from 0 to 255 represents a character output by your workstation. $Toord converts the given character to the corresponding decimal number.

If char contains more than one character, only the first character is converted.

The number produced by the $toord function can be converted back to a character by the $tochr function.

Example

$toord(" ")

Evaluates to 32 (on ASCII machines).

$toord(tochr(anynumber ))

Evaluates to any number.

See Also

$toalpha

$tocharacter

$tochr

$todate

About Functional Expressions

Number Literals

$isupper

Tests if the letters in a character string are uppercase.

Syntax

$isupper(string)

Parameters

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

Return Value

1-character binary string. Evaluates to 1 ($True) if string meets the validation test; otherwise, evaluates to 0 ($False).

Comments

This function tests if a particular character string is uppercase, i.e., contains no lowercase letters.

Example

$isupper("aBC")

Evaluates to $False.

$isupper(43)

Evaluates to $True.

See Also

$isalphabetic

$isalphanumeric

$isdate

$isdigit

$islower

$isnumber

$iszimname

About Character Literals

About Functional Expressions

$isalphabetic

Tests if a character string contains only letters.

Syntax

$isalphabetic(string)

Parameters

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

Return Value

1-character binary string. Evaluates to 1 ($True) if string meets the validation test; otherwise, evaluates to 0 ($False).

Comments

This function tests if a particular character string is alphabetic.

Example

$isalphabetic("abc")

Evaluates to $True.

$isalphabetic("abc1")

Evaluates to $False.

See Also

$isalphanumeric

$isdate

$isdigit

$islower

$isnumber

$isupper

$iszimname

Character Literals

Functional Expressions

$islower

Tests if the letters in a character string are lowercase.

Syntax

$islower(string)

Parameters

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

Return Value

1-character binary string. Evaluates to 1 ($True) if string meets the validation test; otherwise, evaluates to 0 ($False).

Comments

This function tests if a particular character string is lower case, i.e., contains no uppercase letters.

Example

$islower("Abc")

Evaluates to $False.

$islower(34)

Evaluates to $True.

See Also

$isalphabetic

$isalphanumeric

$isdate

$isdigit

$isnumber

$isupper

$iszimname

About Character Literals

About Functional Expressions

$value

Provides a default value for an expression that can be $Null.

Syntax

$value(expression1,expression2)

Parameters

expression1any expression
expression2any expression

Return Value

Same as the selected expression.

Comments

If expression1 is not $Null, $value returns the value of expression1; otherwise, it returns the value of expression2.

Example

detail line "Employee Number: " $value(EmpNum,"N/A")

Traps $Null values in a report and replaces them with “N/A”.

See Also

About Functional Expressions

CASE

Expressions and the $Null Property

IS [NOT] [$]NULL

en_CAEnglish