R/G Special Functions

 

Windows XP – Report Generator V1.00 Functions and Their Uses:

+  Adds two numeric fields or concatenates two string fields.

Syntax: 

Number1 + Number2 

String1 + String2 

Examples:  

1 + 2 (returns 3) 

“AB” + “CD” (returns “ABCD”)

 

-  Subtracts two numeric fields.

Syntax: 

Number1 - Number2 

Examples:  

4 - 1 (returns 3) 

 

*  Multiplies two numeric fields.

Syntax: 

Number1 * Number2 

Examples:  

4 * 2 (returns 8) 

 

/  Divides two numeric fields.

Syntax: 

Number1 / Number2 

Examples:  

10 / 2 (returns 5) 

 

^  Raises to the power.

Syntax: 

Number1 ^ Number2 

Examples:  

10 ^ 2 (returns 100) 

 

=  If two values are equal returns 1; otherwise, returns 0.

Syntax: 

Expression1 = Expression2  

Examples:  

4 = 4 (returns 1)

5 = 4 (returns 0)

“A” = “A” (returns 1)

“A” = “B” (returns 0)

 

<  If the first value is less the second value returns 1; otherwise, returns 0.

Syntax: 

Expression1 < Expression2 

Examples:  

3 < 4 (returns 1)

4 < 4 (returns 0)

“A” < “B” (returns 1)

“A” < “A” (returns 0)

 

 

>  If the first value is greater the second value returns 1; otherwise, returns 0.

Syntax: 

Expression1 > Expression2 

Examples:  

5 > 4 (returns 1)

4 > 4 (returns 0)

“B” > “A” (returns 1)

“A” > “A” (returns 0) 

 

<>  If the first value is not equal to the second value returns 1; otherwise, returns 0.

Syntax: 

Expression1 <> Expression2 

Examples:  

5 <> 4 (returns 1)

4 <> 4 (returns 0)

“B” <> “A” (returns 1)

“A” <> “A” (returns 0)

 

<=  If the first value is less than or equal to the second value returns 1; otherwise, returns 0.

Syntax: 

Expression1 <= Expression2

Examples:  

3 <= 4 (returns 1)

4 <= 4 (returns 1)

5 <= 4 (returns 0)

“A” <= “B” (returns 1)

“A” <= “A” (returns 1)

“B” <= “A” (returns 0) 

 

>=  If the first value is greater than or equal to the second value returns 1; otherwise, returns 0.

Syntax: 

Expression1 >= Expression2 

Examples:  

4 >= 4 (returns 1)

5 >= 4 (returns 1)

3 >= 4 (returns 0)

“A” >= “A” (returns 1)

“B” >= “A” (returns 1)

“A” >= “B” (returns 0) 

 

AND (Equation)  If the equation to the left is true and the equation to the right is true returns 1; otherwise, returns 0.

Syntax: 

Equation1 AND Equation2 

Examples:  

( 5 > 4 ) AND ( 4 = 4 ) (returns 1)

( 4 > 4 ) AND ( 4 = 4 ) (returns 0)

( 4 > 4 ) AND ( 3 = 4 ) (returns 0) 

 

AND (Numeric)  Performs a logical AND on the bits of two numbers.

Syntax: 

Number1 AND Number2 

Examples:  

3 AND 7 (returns 3)

3 AND 4 (returns 0) 

 

OR (Equation)  If the equation to the left is true or the equation to the right is true returns 1; otherwise, returns 0.

Syntax: 

Equation1 OR Equation2 

Examples:  

( 5 > 4 ) OR ( 4 = 4 ) (returns 1)

( 4 > 4 ) OR ( 4 = 4 ) (returns 1)

( 4 > 4 ) OR ( 3 = 4 ) (returns 0) 

 

OR (Numeric)  Performs a logical OR on the bits of two numbers.

Syntax: 

Number1 OR Number2 

Examples:  

3 OR 7 (returns 7)

3 OR 4 (returns 7) 

 

ABS(  Returns the absolute (positive) value.

Syntax: 

ABS(Number1) 

Examples:  

ABS( -7 ) (returns 7)

ABS( 7 ) (returns 7) 

 

INT(  Returns the integer.

Syntax: 

INT(Number1)

Examples:  

INT( 7.025 ) (returns 7)

INT( 7 ) (returns 7) 

 

SGN(  Returns the Sign (-1, 0, or +1).

Syntax: 

SGN(Number1)

Examples:  

SGN( -7 ) (returns -1)

SGN( 0 ) (returns 0)

SGN( 7 ) (returns 1) 

 

CHR(  Returns the printable character of the number specified (1-255).

Syntax: 

CHR(Number1)

Examples:  

CHR( 65 ) (returns “A”)

CHR( 122 ) (returns “z”) 

 

VAL(  Returns the numeric value of a string expression.

Syntax: 

VAL(String1) 

Examples:  

VAL( “65” ) (returns 65) 

 

STR(  Returns the string expression of a number.

Syntax: 

STR(Number1)

Examples:  

STR( 65 ) (returns “65”) 

 

LEFT(  Returns the leftmost characters of a string.

Syntax: 

LEFT(String1, Number1)

Examples:  

LEFT( “ABCDEF” , 2 ) (returns “AB”) 

 

RIGHT(  Returns the rightmost characters of a string.

Syntax: 

RIGHT(String1, Number1)     

Examples:  

RIGHT( “ABCDEF” , 2 ) (returns “EF”) 

 

MID(  Returns the specified middle characters of a string.

Syntax: 

MID(String1, Number1, Number2(optional)) 

Examples:  

MID( “ABCDEF” , 2 , 3 ) (returns “BCD”)

MID( “ABCDEF” , 3 ) (returns “CDEF”) 

 

TRIM(  Trims all leading and trailing spaces from a string.

Syntax: 

TRIM(String1)

Examples:  

TRIM( “ ABCDEF ” ) (returns “ABCDEF”) 

 

RTRIM(  Trims all trailing spaces from a string.

Syntax: 

RTRIM(String1)

Examples:  

RTRIM( “ ABCDEF ” ) (returns “ ABCDEF”) 

 

LTRIM(  Trims all leading spaces from a string.

Syntax: 

LTRIM(String1) 

Examples:  

LTRIM( “ ABCDEF ” ) (returns “ABCDEF ”) 

 

UCASE(  Converts all lower case characters to upper case.

Syntax: 

UCASE(String1) 

Examples:  

  UCASE ( “abcdef123ABC” ) (returns “ABCDEF123ABC” ) 

 

FLIP(  Flips the string at the first comma.

Syntax: 

FLIP(String1, Number1)   (Number1 indicates whether or not to flip 1=Flip, 0=NoFlip)

Examples:  

FLIP( “Smith, John M.”, 1 ) (returns “John M. Smith” )

FLIP( “Widgets, Inc.”, 0 ) (returns “Widgets, Inc.” ) 

 

INSTR(  Returns the location in a string where a second string can be found.

Syntax: 

INSTR(String1, String2) 

Examples:  

INSTR( “ABCDEF”, “CDE” ) (returns 3)

INSTR( “CDE” , “ABCDEF” ) (returns 0) 

 

DAYSBETWEEN(  Returns the number of days between two dates.

Syntax: 

DAYSBETWEEN(String1, String2)

Examples:  

DAYSBETWEEN(“19980501”, “19980510”) (returns 9) 

 

ADATE(  Returns the 3-character month, 2-digit day, comma, and 4-digit year.

Syntax: 

ADATE(String1)

Examples:  

ADATE( “19980205” ) (returns “Feb 5, 1998”)

 

FDATE(  Returns mm/dd/yyyy.

Syntax: 

FDATE(String1)

Examples:  

FDATE( “19980205” ) (returns “02/05/1998”)

 

LDATE(  Returns the alpha month, 2-digit day, comma, and 4-digit year.

Syntax: 

LDATE(String1)

Examples:  

LDATE( “19980205” ) (returns “February 5, 1998”)

 

FTIME(  Returns hh:mm:ss am/pm.

Syntax: 

FTIME(String1)

Examples:  

FTIME( “13:05:10” ) (returns “1:05:10 pm”)

 

MTIME(  Returns hh:mm.

Syntax: 

MTIME(String1) 

Examples:  

MTIME( “13:05:10” ) (returns “13:05”)

 

STIME(  Returns hh:mm am/pm.

Syntax: 

STIME(String1)

Examples:  

STIME( “13:05:10” ) (returns “1:05 pm”)

 

RANGE(  Returns the user-entered range specified.

Syntax: 

RANGE(Number1)

Examples:  

First Key in the Primary file is Vendor Number. RANGE( 1 ) (returns “Vendor Number - ZZZZZZZZZZ” )

 

TOTAL(  Returns a total that is stored in the Report Generator (this should rarely, if ever be used).

Syntax: 

TOTAL(Number1)

Examples:  

The first total accumulated on the report is a sum of #’s and this sum equals 500. TOTAL( 1 ) ( returns 500 )

 

COUNT(  Returns the count of detail lines printed within the section specified.

Syntax: 

COUNT(SectionNumber1) 

Examples:  

Group 1 contains 10 detail lines for the group that this value is printed in. COUNT( 1 ) ( returns 10 )

The report contains 50 detail lines. COUNT( 10 ) ( returns 50 )

 

GRPCOUNT(  Returns the count of group breaks printed as it relates to a particular section.

Syntax: 

GRPCOUNT(GroupNumber, SectionNumber)

Examples:  

Group 1 has changed 15 times within Section 2. GRPCOUNT ( 1, 2 ) ( returns 15 )  

Group 2 has changed 100 times for the entire report (Section 10). GRPCOUNT ( 2, 10 ) ( returns 100 )

 

GRPCHANGED(  Indicates whether a group has changed.

Syntax: 

GRPCHANGED (GroupNumber)

Examples:  

Group 1 totals have just been printed, but the next group 1 header has NOT been 

printed. GRPCHANGED (1) ( returns 1 )

 

GRPPAGENO(  Group page number.

Syntax: 

GRPPAGENO(GroupNumber) 

Examples:  

Group 2 has just changed on the 15th page of the report. GRPPAGENO(2) ( returns 1 )

 

PAGENO  Report page number.

Syntax: 

PAGENO

Examples:  

The 15th page of the report. PAGENO (returns 15)

 

DATE  Team Software system date.

Syntax: 

DATE

Examples:  

DATE (returns the date shown on the bottom panel in reverse date format “19980717”)

 

TIME  System time.

Syntax: 

TIME

Examples:  

  TIME (returns the time shown on the bottom panel in military format “13:05:10”)

 

USERNAME  User name.

Syntax: 

USERNAME

Examples:  

USERNAME (returns the Name of the user who is logged in)

 

USERID  User ID.

Syntax: 

USERID

Examples:  

USERID (returns the ID of the user who is logged in)

 

MACHID  ID associated with the computer.

Syntax: 

MACHID

Examples:  

MACHID (returns the unique ID associated with this computer)

 

PERIOD  Team Software period.

Syntax: 

PERIOD

Examples:  

PERIOD (returns the period shown on the bottom panel)

 

IFCOND  User-entered If Condition.

Syntax: 

IFCOND

Examples:  

IFCOND (returns the If Condition entered by the user)

 

DESCEND  The word Descending if the descending flag is set.

Syntax: 

DESCEND

Examples:  

The user selected Descending. DESCEND (returns “Descending”) The user did NOT select Descending. DESCEND (returns “”)

 

ASCEND  The word Ascending based on the descending flag.

Syntax: 

ASCEND

Examples:  

The user selected Descending. ASCEND (returns “”) The user did NOT select Descending. ASCEND (returns “Ascending”)

 

RPTTYPE  The user-entered Report Type.

Syntax: 

RPTTYPE

Examples:  

RPTTYPE (returns the type of report printed ( “Normal”, “Group/Grand Totals Only”, etc.. )

 

LIMIT(  Returns the amount of a number that does not exceed a maximum limit, based upon a factoring number.

Syntax: 

LIMIT (Number, Factor, Limit)

Examples:  

Determine how much of an employee’s earnings in month 4 have not exceeded his State Unemployment Limit. (Number = month 4 earnings, Factor = month 1 + month 2 + month 3, Limit = State Unemployment Limit) LIMIT ( 1900, 5700, 7000 ) ( returns 1300 ) LIMIT ( 2200, 6600, 7000 ) (returns 400) LIMIT ( 2500, 7500, 7000 ) ( returns 0 )

 

OVERLIMIT(  Returns the amount of a number that exceeds a maximum limit, based upon a factoring number.

Syntax: 

OVERLIMIT (Number, Factor, Limit)

Examples:  

Determine how much of an employee’s earnings in month 4 have exceeded his State Unemployment Limit. (Number = month 4 earnings, Factor = month 1 + month 2 + month 3, Limit = State Unemployment Limit) OVERLIMIT ( 1900, 5700, 7000 ) ( returns 600 ) OVERLIMIT ( 2200, 6600, 7000 ) ( returns 1800 ) OVERLIMIT ( 2500, 7500, 7000 ) ( returns 2500 ) 

 

NEG(  Returns a positive or negative number, based upon a condition.

Syntax: 

NEG (Number, Condition)

Examples:  

NEG ( 1900, “A=B” ) ( returns 1900 )  

NEG ( 1900, “A=A” ) ( returns –1900 )

 

 

MTD(  Returns a Month-To-Date figure based upon a date.

Syntax: 

MTD(Date, Filename (dta prefix IS included), FieldName(Month # NOT included)) 

Examples:  

Returns a monthly value from the Employee YTD file based upon the date and field specified. This example uses the field called Gross1…Gross12. MTD ( “20000501” or “05/01/2000”, dtaPREmpYTD, Gross ) (returns the amount stored in month #5 (i.e. dtaPREmpYTD!Gross5)

 

QTD(  Returns a Quarter-To-Date figure based upon a date.

Syntax: 

QTD(Date, Filename (dta prefix IS included), FieldName(Month # NOT included)) 

Examples:  

Returns a quarterly value from the Employee YTD file based upon the date and field specified. This example uses the field called Gross1…Gross12. QTD ( “20000501” or “05/01/2000”, dtaPREmpYTD, Gross ) (returns the sum of the amounts stored in months #4 through #5 (i.e. dtaPREmpYTD!Gross4 + dtaPREmpYTD!Gross5)

 

YTD(  Returns a Year-To-Date figure based upon a date.

Syntax: 

YTD (Date, Filename (dta prefix IS included), FieldName(Month # NOT included)) 

Examples:  

Returns an annual value from the Employee YTD file based upon the date and field specified. This example uses the field called Gross1…Gross12. YTD ( “20000501” or “05/01/2000”, dtaPREmpYTD, Gross ) (returns the sum of the amounts stored in months #1 through #5 (i.e. dtaPREmpYTD!Gross1 + dtaPREmpYTD!Gross2 + dtaPREmpYTD!Gross3 + dtaPREmpYTD!Gross4 + dtaPREmpYTD!Gross5)

 

DEVNAME  System output device (“Screen” or printer device name).

Syntax: 

DEVNAME

Examples:  

DEVNAME (returns the name of the system output device ( “SCREEN”, “Epson Stylus 850”, etc.. )

No Right Mouse