Variable Related Attributes
The attributes of a Variable determine its nature and behaviour. Some of the widely used attributes are discussed below:
Default
This attribute is used to assign a default value to a variable, based on the ‘Type’ defined.
Syntax
[Variable : <Variable Name>]
Default : <Initial Value>
Value of the variable should adhere to the data type specified with Type Attribute.
Example
[Variable : DSP HasColumnTotal]
Type : Logical
Default : Yes
The Default initial value for the logical Variable DSP HasColumnTotal is set to YES. This variable will begin with an initial value YES in the Reports, unless overridden by the System Formula. We will learn about the System Formula in the coming sections.
Persistent
This attribute decides the retention periodicity of the attribute. If the attribute ‘Persistent’ is set to YES, then the latest value of the variable will be retained across the sessions, provided the variable is not a local variable.
Syntax
[Variable : <Variable Name>]
Persistent : <Logical Value>
Example
[Variable : SV Backup Path]
Type : String
Persistent : Yes
The attribute ‘Persistent’ of the variable SV Backup Path has been set to YES, which means that it retains the latest path given by the user even during the concurrent sessions of Tally.
Repeat
This attribute is mainly used to achieve the Auto Column behaviour in various Reports. Each Column is created with a subsequent Object in a Collection automatically, till all the columns required for Auto Columns exhaust. The ‘Repeat’ attribute has its value as a variable which has the collection of Objects, for which the columns need to be generated. Every time the Repeat is executed, the column for the subsequent Object is added.
Syntax
[Variable : <Variable Name>]
Repeat : <Variable Value>
Example
[Variable : SV FromDate]
Type : Date
Volatile : Yes
Repeat : ##DSPRepeatCollection
##DSPRepeatCollection variable receives the Collection Name from a Child report, which accepts inputs from the user regarding the columns required. Variable SVFromDate gets repeated over the subsequent period in the Collection each time the column repeats.
Type
This attribute determines the Type of the value that will be held by the variable. The Types of values that a variable can handle are String, Logical, Date and Number. In the absence of this attribute, a variable assumes to be of the Type String, by default.
Syntax
[Variable : <Variable Name>]
Type : <Data Type>
Example
[Variable : ICFG Supplementary]
Type : Logical
A logical variable ICFG Supplementary is defined and used to control the behaviour of certain reports, based on its logical value, as configured by the user.
Volatile
In cases where the ‘Volatile’ attribute in the Variable definition is set to YES, the variable is capable of retaining multiple values, i.e., its original value with its subsequent values, are stored as a stack. The default value of this attribute is YES.
In cases where a new report R2 is initiated, using a volatile variable V, from the current report R1, the current value of the volatile variable will be saved as in a stack, and the variable can assume a new value in the new report R2. Once the previous report R1 is returned back from the report R2, the previous value of the variable will be restored. A classic example of this is a drill-down Trial Balance.
Syntax
[Variable : <Variable Name>]
Volatile : <Logical Value>
Example
[Variable : GroupName]
Type : String
Volatile : Yes
The ‘Volatile’ attribute of Group Name Variable is set to YES, which means that the variable ‘Group Name’ can store multiple values, which have been received from multiple reports.