GRA - Access any account details (Reports & Settings Report Generator function)

From Catalyst
Jump to: navigation, search

Syntax

$GRA{ledger, account, expression}

Description

In general, changes the Account code being reported on.

This used to be called $ACC.


Parameters

ledger
A text parameter that can be omitted.
Account ledger to use (see below).
S
Sales Ledger (Customers).
P
Purchase Ledger (Suppliers).
C
Contacts (" Unit Workshop" and " Unit Sales" Systems only).
account
A text parameter that can be omitted.
Account code to use (see below).
expression
A text or numeric parameter that can be omitted.
Variable or formula to evaluate (see below).

Returns

A text or numeric (depending on the parameters) value. This function may be used in three ways.

All parameters are supplied.
$GRA{"P",S86,A03}
The result of the given expression using the details of the account code supplied is returned. For the example above, (using the variable S86, from the Stock system), the name of the account of the preferred supplier of the current stock line would be returned.
No expression is supplied.
$GRA{"P",S86}
Changes the account being reported on; i.e. all "A" variables (and other variables which use the current account being reported on), in the remainder of the current block will use the details from the account supplied. If used in a Range screen then this will affect the whole report. If no expression is supplied, the actual result of the function will be numeric - '1' if the account exists or '0' if otherwise.
$GRA{"S",IF V67="" THEN V38 ELSE V67}
This would switch the account to the unit's keeper (V67), or the unit's sale account (V38) if the keeper was spaces. This could be used in "Range Filter (2) - Detailed" of a mailshot, for instance, to set the destination account.
No parameters are supplied.
$GRA{}
The function may be used in this way in a block after using the function as in method 2, to change the account being reported on back to the previous value.