Difference between revisions of "Special Purpose Operators"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 2: Line 2:
  
  
==The Macro Operator (&)==
+
==The Macro Operator/Function ([[&]])==
 
When an ’&’ ampersand character precedes a variable or an expression contained within parentheses, the result of the expression is substituted into the command.  Nested macros are not supported.
 
When an ’&’ ampersand character precedes a variable or an expression contained within parentheses, the result of the expression is substituted into the command.  Nested macros are not supported.
  
  
 
==The Alias Operator (->)==
 
==The Alias Operator (->)==
An open table can be referred to by its alias name and its fields can be accessed using the alias operator.  The alias name is either a name you have specified in the USE <table> ALIAS <alias name> command, or, by default, the first ten characters of the table basename.  The letters a-z (excluding m) can also be used as an alias to the work areas 1-26 (excluding 13).  M is used to reference memory variables, so is not available as a table alias
+
An open table can be referred to by its alias name and its fields can be accessed using the alias operator.  The alias name is either a name you have specified in the [[USE|USE &#060;table&#062; ALIAS &#060;alias name&#062;]] command, or, by default, the first ten characters of the table basename.  The letters a-z (excluding m) can also be used as an alias to the work areas 1-26 (excluding 13).  M is used to reference memory variables, so is not available as a table alias
  
  

Latest revision as of 14:43, 24 March 2009

Three special operators exist within the Recital/4GL. These are:


The Macro Operator/Function (&)

When an ’&’ ampersand character precedes a variable or an expression contained within parentheses, the result of the expression is substituted into the command. Nested macros are not supported.


The Alias Operator (->)

An open table can be referred to by its alias name and its fields can be accessed using the alias operator. The alias name is either a name you have specified in the USE <table> ALIAS <alias name> command, or, by default, the first ten characters of the table basename. The letters a-z (excluding m) can also be used as an alias to the work areas 1-26 (excluding 13). M is used to reference memory variables, so is not available as a table alias


The Dot Operator (.)

The dot operator ’.’ is used to reference either the properties of objects, or it can be used interchangeably with the alias operator.


Example

// Macro Operator Example
cTABLE = [employees]
use &cTABLE
 
// Alias Operator Example
cEMPNAME = &(cTABLE + "->NAME")
 
// Dot Operator Example
use employees
 
class EmpRecord
  public:
property NAME
property SALARY
  public:
method IDENT
return "Employee Record"
endclass
 
oMYREC = new EmpRecord()
cTYPE = oMYREC.IDENT()
? cTYPE