Friday, December 21, 2012

Tip of the Day: The Complete R:BASE System Variable List
Product: R:BASE eXtreme 9.5 (32/64)
Build..: 9.5.2.11212 or higher www.rupdates.com
Section: System Variables, Environment Settings

R:BASE supports the use of system variables that provide information, and enhance
the environment, for that R:BASE instance.

Some system variables are preset and constant, some are updated after actions are
taken, some are created after actions are taken, while others can be defined to
adjust areas of R:BASE.

The existence of following system variables are constant. The values can be verified
by typing SHOW VARIABLES at the R> Prompt.

R>SHOW VARIABLES
Variable                         = Value                          Type
--------------------------------   ------------------------------ -------
#DATE                            = 12/21/2012                     DATE
#TIME                            = 10:00 AM                       TIME
#PI                              = 3.14159265358979               DOUBLE
SQLCODE                          = 0                              INTEGER
SQLSTATE                         = 00000                          TEXT
#NOW                             = 12/21/2012 10:00 AM            DATETIME

  . #DATE - Stores the current system date
  . #TIME - Stores the current system time
  . #PI - Stores the value of as a DOUBLE data type (3.14159265358979)
  . SQLCODE - Holds the result of the previous SQL command
. SQLSTATE - Stores a 5-character long return code string that indicates the status
    of the previous SQL statement
  . #NOW - Stores the current system date and time

The system variables can be used in variable expressions to capture system information.

Examples:

  SET VAR vToday DATE = .#DATE
  SET VAR vTimer TIME = (.#TIME + 10)
  SET VAR vNum DOUBLE = (.#PI * 56 ** 2)
  SET VAR vRightNow = .#NOW

R>SHOW VARIABLES
Variable                         = Value                          Type
--------------------------------   ------------------------------ -------
#DATE                            = 12/21/2012                     DATE
#TIME                            = 10:20 AM                       TIME
#PI                              = 3.14159265358979               DOUBLE
SQLCODE                          = 0                              INTEGER
SQLSTATE                         = 00000                          TEXT
#NOW                             = 12/21/2012 10:20 AM            DATETIME
vNum                             = 9852.03456165758               DOUBLE
vToday                           = 12/21/2012                     DATE
vTimer                           = 10:20 AM                       TIME
vRightNow                        = 12/21/2012 10:19 AM            DATETIME

With the following example;

  SELECT netamount FROM transmaster +
  WHERE netamount IS NULL
  IF SQLCODE <> 100 THEN
    --Perform Task here
  ENDIF

The IF...ENDIF condition checks if any rows exist. If valid rows are found, SQLCODE is set to 0, and the control passes to the command after ENDIF. If no data is found, SQLCODE is set to 100. A negative number for SQLCODE indicates failure. Based on the value of
SQLCODE, the WHENEVER command can be used to call an error handling routine.

SQLSTATE was added for Oterro compatibility. Values may be set by attached server tables
commands or Stored Procedures.

The following variables can be defined to enhance R:BASE use:

  . RBTI_CEM_FONTSIZE - Alters the font size for constraint error messages
  . RBTI_CEM_FONTCOLOR - Alters the font color for constraint error messages
  . RBTI_ERR_FONTSIZE - Alters the font size for general error messages
  . RBTI_ERR_FONTCOLOR - Alters the font color for general error messages
. RBTI_IMG_FOLDER - Defines a valid folder path where all "Open Image" dialogs will
    initially start

Examples:

  SET VAR RBTI_CEM_FONTSIZE INTEGER = 14
  SET VAR RBTI_CEM_FONTCOLOR TEXT = BLUE
  SET VAR RBTI_ERR_FONTSIZE INTEGER = 12
  SET VAR RBTI_ERR_FONTCOLOR TEXT = RED
  SET VAR RBTI_IMG_FOLDER TEXT = 'C:\TEMP\IMAGES\'

With the FEEDBACK operating condition set ON to display processing results, system variables will be create containing values. The FEEDBACK system variables will be generated and hold
the values for the record changes and the elapsed time for the command.

  . RBTI_RowsInserted - Holds the value for the number of rows inserted
  . RBTI_RowsDeleted - Holds the value for the number of rows deleted
  . RBTI_RowsUpdated - Holds the value for the number of rows updated
  . RBTI_ElapsedTime - Holds the value for the elapsed processing time

The RBTI_PRNSETUP system variable stores the button selection (OK/CANCEL) after using the PRNSETUP dialog. After launching PRNSETUP window, and pressing "OK", the RBTI_PRNSETUP
variable will exist.

R>SHOW VARIABLES
Variable                         = Value                                   Type
--------------------------------   ------------------------------ -------
#DATE = 12/21/2012 DATE #TIME = 10:43 AM TIME #PI = 3.14159265358979 DOUBLE SQLCODE = 0 INTEGER SQLSTATE = 00000 TEXT #NOW = 12/21/2012 10:43 AM DATETIME RBTI_PRNSETUP = OK TEXT

The following system variables are specific to R:BASE Forms:

  . RBTI_DBGRID_COLUMN - Stores the name of focused Column on a DB Grid
. RBTI_DIRTY_FLAG - Returns 1 if any database control value(s) in the form was changed,
    or 0 if nothing was changed
  . RBTI_FORM_ALIAS - Stores the name of a focused form, if AS alias is used
. RBTI_FORM_COLNAME - Stores the name of focused column of a database control on a form . RBTI_FORM_COLVALUE - Stores the value of focused column database control on a form . RBTI_FORM_COMPID - Stores the value of focused DB/Variable Edit control's Component ID . RBTI_FORM_DATATYPE - Stores the data type of focused column database control on form . RBTI_FORM_DIRTYVAR - Returns 1 if any Variable Control value(s) in form were changed,
    or 0 if nothing was changed
. RBTI_FORM_FORMNAME - Stores the name of the current form (useful when using multiple
    forms simultaneously)
. RBTI_FORM_MODE - Stores the value of current mode of the form; ENTER, EDIT, or BROWSE . RBTI_FORM_TBLNAME - Stores the name of the current table in a form (useful with multi-
    table forms)
  . RBTI_FORM_VARNAME - Stores the name of focused Variable Control on a form
. RBTI_FORM_VARVALUE - Stores the value of focused Variable Control on a form

The following system variable is specific to R:BASE Reports:

  . RBTI_REPORT_NAME - Stores the name of the current report

The following system variable is specific to R:BASE Labels:

  . RBTI_LABEL_NAME - Stores the name of the current label

When using the Form Designer, the "System Variable" control is an object that can be placed on the form to display system information. The following values are available:

  . Date
  . Date and Time
  . Time
  . R:BASE Name
  . R:BASE User
  . Windows User
  . Computer Name
  . Database Name
  . Default Printer
  . Current Printer
  . R:BASE Version
  . R:BASE Build
  . R:BASE Version and Build
  . Current Directory
  . Record Count
  . Record Number and Count
  . Record Number and Count with Description
  . Record Number
  . Record Number with Description

When using the Report/Label Designer, the "System Variable" control is an object that can be placed on the report/label to display system information. The following values
are available:

  . Date
  . Date and Time
  . Document Name
  . Print Date/Time
  . Page Count
  . Page Set
  . Page Set with Description
  . Page Number
  . Page Number with Description
  . Time
  . R:BASE Name
  . R:BASE User
  . Windows User
  . Computer Name
  . Database Name
  . Default Printer
  . Current Printer
  . Version
  . Build
  . Version/Build
  . Current Folder

Stay productive, my friends!

Very Best R:egards,

Razzak.

www.rbase.com
www.facebook.com/rbase
www.RazzakMemon.com


Reply via email to