TDL Components

On this page

Definitions

Attributes

Modifiers

Actions

Data types

Operators

Functions

TDL is a language based on definitions. It is an action-driven language. Whenever the user performs an action, a particular segment of code gets executed. In this lesson, an overview and basic functionality of each component involved in a TDL program will be provided.

Writing a Basic TDL Program

TDL allows us to define tasks in standard English statements. This simplifies the process of definition, allowing even a person without any programming language background to work on TDL.

The TDL statements required to perform a particular task, can be created in a file using IDE provided by Tally.ERP 9, such as Tally Developer. Such a file is called a TDL file.

Steps to create a TDL Program

Open any ASCII text editor such as notepad, or use the IDE Tally Developer, provided by Tally.ERP 9.

Create a new file.

Type TDL statements in the file.

Save the file with a meaningful name and extension, as applicable to the editor. The editor can save the file with an extension ‘. txt ’, ‘. tdl’ .

The file can be compiled into a file with an extension.tcp (Tally Compliant Product). It is possible to compile the file for a particular Tally serial number.

It is possible to run all files, i.e.,.txt,.tdl and.tcp in Tally.ERP 9.

Specification of TDL Files

There are two ways of implementing the TDL code:

Specifying the TDL files in Tally.ini (Configuration Settings File)

Specifying the TDL files through Tally.ERP 9 application configuration screen

Specifying the TDL files in Tally.ini

The path of the TDL program has to be included in the Tally.ini file, using a parameter called ‘TDL’. If the parameter ‘User TDL’ is set to NO, Tally.ERP 9 will not read any TDL parameters specified in the Tally.ini file.

Syntax

User TDL = Yes

TDL      = <Path\filename> with extension

Example

User TDL = Yes

TDL     = C:\Tally.ERP 9\MyReport.tcp

OR

TDL = C:\Tally.ERP 9\MyReport.txt

When Tally.ERP 9 starts, it looks for a file named ‘MyReport.tcp’ or ‘MyReport.txt’ in the directory C:\Tally.ERP 9. On loading the default TDL files into memory, Tally.ERP 9 reads and loads every TDL file mentioned in Tally.ini into memory before displaying the first Menu, ‘Gateway of Tally’.

Specifying TDL file through Tally.ERP 9 application configuration screen

Alternatively, the TDL file name can be specified in TDL Configuration screen, by going to F12: Configure > Product & Features , and clicking on F4:Manage Local TDLs . In this screen, set the value as YES for Load TDLs on Start up and specify the Path\filename, with extension, in List of TDLs to preload on Tally Startup . Following figure shows the TDL configuration screen:

Figure_2.1_Specification_of_TDL_files.jpg

To load a Default Company in Tally.ERP 9, the Load parameter is used as follows:

Example

Default Companies = yes

Load              = 00002

Here, 00002 is the company folder that resides in Tally.ERP 9\Data . The data path can be specified with the parameter ‘Data’ .

Example

Data = C:\Tally.ERP 9\Data

Note: Restart Tally.ERP 9 whenever there are changes made in the TDL program, so that they can be implemented.

Executing Multiple Files using Include Definition

Since TDL can span or exist across files, the definition ‘INCLUDE’ provides the convenience of modularising the application and specifying all of them in one TDL file. It allows the user to include TDL code existing in separate file/files, into the current file.

‘Include’ , as the name suggests, gives us the ability to include another TDL file into a file, instead of declaring it in Tally.ini separately.

Syntax

[Include : <path/filename>]

In case the TDL file is in the same directory, either the file name or the complete path for the file has to be provided.

Example

Let us assume we are using two files, sample1.txt and sample2.txt. To run both the files, we have to include sample2.txt in sample1.txt.

[Include : sample2.txt]

TDL Interfaces

We have already seen that TDL is a language based on definitions. When we start Tally.ERP 9, the Interfaces which are visible on the screen are Menu, Report, Button and Table. In TDL, specific definitions are provided to create the same.

A Report and Menu can exist independently. A Menu is created by adding items to it while a Report is created using Form, Part, Line and Field. These are the definitions which cannot exist without a Report. TDL operates through the concept of an action which is to be performed and Definition on which the action is performed. The Report is invoked based on the action.

TDL program to create a Report contains the definitions Report, Form, Part, Line and Field and an action to execute the Report. A Report can have more than one Form, Part, Line and Field definitions, but at least one has to be there.

The hierarchy of these definitions is as follows:

Report uses a Form

Form uses a Part

Part uses a Line

Line uses a Field

Field is where the contents are displayed or entered

The Report is called either from a Menu or from a Key event.

Hello TDL Program

The ‘Hello TDL’ program demonstrates the basic structure of TDL. The Report is executed from the existing Menu ‘Gateway of Tally’. Purpose: To invoke a new Report displaying the text “Welcome to the world of TDL” from the main Menu ‘Gateway Of Tally’:

[#Menu: Gateway of Tally]

Item : First TDL : Display : First TDL Report

;;code comments

[Report: First TDL Report]

Form : First TDL Form

[Form: First TDL Form]

Parts : First TDL Part

[Part : First TDL Part]

Lines : First TDL Line

[Line : First TDL Line]

Fields : First TDL Field

[Field : First TDL Field]

Set as : "Welcome to the world of TDL"

This code adds a new Menu Item First TDL in the ‘Gateway Of Tally’ menu. When the Menu Item is selected the report, the Report ‘First TDL Report’ is displayed. The report is in ‘Display’ mode, as the action ‘Display’ is specified while adding the menu item ‘First TDL’. User inputs are not accepted in this report. The text ‘Welcome to the world of TDL’ is displayed in the Report, since it contains only one field.

TDL Components

The TDL consists of Definitions, Attributes, Modifiers, Data Types, Operators, Symbols and Prefixes, and Functions. Let us now analyse the components of the language.

Definitions

Tally Definition Language (TDL) is a non-procedural programming language based on definitions. TDL works on named definitions. The biggest advantage of working with TDL is its re-usability of definitions.

All the definitions are reusable by themselves and can be a part of other definitions. Whenever a change in code needs to be reflected in a program, Tally.ERP 9 must be restarted. All definitions start with an open square bracket and end with a closed bracket.

Syntax

[<Definition Type> : <Definition Name>]

Where,

< Definition type > is the name of one of the predefined definition types available in the platform, example, Collection, Menu, Report, Form, Part, Line, etc.

< Definition Name > refers to any user-defined name, which the user provides to instantiate the definition, i.e., whenever a definition is created, a new object of a particular definition type comes into existence.

Example

[Part : PartOne]

In this example, the type of definition is Part and the name of the definition is PartOne .

Types of Definitions

The various definitions in TDL are categorized as follows:

Interface Definitions – Menu, Report, Form, Part, Line, Fields, Button, Table

Data Definitions – Object, Variable, Collection

Formatting Definitions – Border, Style, Color

Integration Definitions – Import Object, Import File

Action Definitions – Key

System Definitions

Interface Definitions

Definitions which are used to create a user interface are referred to as Interface definitions. The definitions in this category are Menu, Report, Form, Part, Line, Field, Button and Table.

Menu : A Menu displays a list of options. The Tally.ERP 9 application determines the action to be performed on the basis of the Menu Item selected by the user. The ‘Gateway of Tally’ is an example of a ‘Menu’. A Menu can activate another Menu or Report.

Report : This is the fundamental definition of TDL. Every screen which appears in Tally.ERP 9, i.e., any input screen or output screen, is created using the ‘Report’ definition. A Report consists of one or more Forms.

Form : A Form consists of one or more Parts.

Part : A Part consists of one or more Lines.

Line : A Line consists of one or more Fields.

Field : It is the place where data (constant or variable) is actually displayed/entered.

Button : The user can perform an action in three ways, i.e., by selecting a menu item, by pressing a key or by clicking on a button. The ‘Button’ definition allows the user to display a button on the Button bar and execute an action, when it is clicked.

Table : The ‘Table’ definition displays a list of values as a Table. Data from any collection can be displayed as a Table.

Data Definitions

Definitions which are used for storing the data are referred to as Data Definitions. The definitions in this category are Object, Variable and Collection.

Object : An object is the definition which consists of data, and the associated/related functions, commonly called as methods that manipulate the data. TDL is made up of User interface and Info Objects. Info Objects can be External (user defined) or Internal (platform defined). External or user-defined objects are not persistent in the Tally database. It is not possible to create an Internal Object Definition in TDL, i.e., they are predefined by the platform. It is, though, possible to perform modifications on it. A Ledger/Group is an example of an internal object.

An object can further contain an object/objects.

Collection : A Collection is a group of objects. Collections can be made up of internal or external objects. These can be based on multiple collections also. We can create a collection by aggregating the collections at a lower level in the hierarchy of objects.

Variables : Variables are used to control the behaviour of reports and its contents. The variables can assume different values during the execution, and based on those values, the application behaves accordingly. The option Plain Paper/Pre-Printed, while printing the invoice, is an example of a variable controlling the report.

Formatting Definitions

Definitions which are used in formatting a user interface are referred to as Formatting Definitions. The definitions in this category are Border, Style and Color.

Border : This introduces a single/double line as per user specifications. Thin Box, Thin Line and Common Border are all examples of pre-defined borders.

Style : The ‘Style’ definition determines the appearance of the text to be displayed by using a font scheme. The Font name, Font style and Font size can be changed/defined using the ‘Style’ definition. In default TDL, the pre-defined Style definitions are Normal Bold, Normal Italic and Normal Bold Italic.

Color : The ‘Color’ definition is used to define a color. A name can be given to an RGB value of color. Once a name is assigned to an RGB color value, it can be expressed as an attribute. In TDL, the only color names that can be specified are Crystal Blue and Canary Yellow.

Integration Definitions

Definitions which make the import of data available in SDF (Standard Data Format) are referred to as Integration Definitions. ‘Import Object’ and ‘Import File’ are the two definitions classified in this category.

Import Object : This identifies the type of information that is being imported into Tally.ERP 9. The importable objects can be of the type Groups, Ledgers, Cost centre, Stock Items, Stock Groups, Vouchers, etc.

Import File : The ‘Import file’ definition allows the user to describe the structure of each record in the ASCII file that is being imported. The field width is specified as an attribute of this definition.

Action Definitions

The action definitions allow the user to define an action, to take place when a key combination is pressed. It also associates an object on which the action is performed. The ‘Key’ definition falls in this category.

Key : The ‘Key’ Definition is used to associate an action with a key combination. The action is performed when the associated key combination is pressed.

System Definitions

System Definitions are viewed as being created by the administrator profile. Any items defined under System Definitions are available globally across the application.

System Definitions can be defined any number of times in TDL. The items defined are appended to the existing list. System Definitions cannot be modified.

Examples of System Definitions are System: Variable, System: Formula, System: UDF and System: TDL Names.

Attributes

Each definition has properties, referred to as ‘Attributes’. There is a predefined set of attributes provided by the platform for each definition type. The attribute specifies the behaviour of a definition. Attributes differ from Definition to Definition. A Definition can have multiple attributes associated with it. Each attribute has a 'Name' (predefined) and an assigned value (provided by the programmer).

A value can be associated to a given attribute either directly, or through symbols and prefixes. Apart from a direct value association of the attribute, there are ways to associate alternate values dynamically, based on certain conditions prevailing at runtime.

Syntax

[<Definition Type> : <Definition Name>]

<Attribute Name> : <Attribute Value>

Where,

< Attribute Name > is the name of an attribute, specific for the definition type.

< Attribute Value > can be a constant or a formula.

Example

[Part : PartOne]

Line : PartOne

Classification of Attributes

The classification of attributes is done based on the number of values they accept, and if they can be specified multiple times under the definition, i.e., based on the number of sub-attributes and the number of values.

There are seven types of attributes:

Single and Single List

A Single type attribute accepts only one value and can’t be specified multiple times. The attributes Set As, Width, Style, etc., are all of ‘Single’ type.

Example

[Field : Fld 1]

Set As : “Hello”

Set As : “TDL”

In this field, the string “TDL” is displayed, as ‘Set As’ is a ‘Single’ type attribute. The value of the last specified attribute will be displayed. A Single List type attribute accepts one value, which can be specified multiple times. This attribute also accepts a comma-separated list.

Example

[Line : Line 1]

Field : Fld 1, Fld 2

Field : Fld 3

The line Line 1 will have three fields Fld 1, Fld 2 and Fld 3.

Dual and Dual List

Dual type attributes accept two values, and can’t be specified multiple times. The attribute ‘Repeat’ is an example of ‘Dual’ type.

Example

Repeat : Line 1 : Collection 1

Dual Li s t ty p e attributes accept t wo va l ues, and can be specified multiple tim e s.

Example

Set : Var 1 : “Hello”

Set : Var 2 : “TDL”

The values “Hello” and “TDL” are being assigned to the variables Var 1 and Var 2, respectively.

Triple and Triple List

Triple type attributes accept three values, and can’t be specified multiple times.

Example

Object : Ledger Entries : First : $LedgerName = “Tally”

Triple List type attributes accept three values, and can be specified multiple times.

Example

Aggr Compute : TrPurcQty: Sum : $BilledQty

Aggr Compute: TrSaleQty : Sum : $BilledQty

The Attribute type ‘Menu item’

The attribute type ‘Menu Item’ allows the user to add a menu item in the given ‘Menu’ definition.

Example

[#Menu : Gateway Of Tally]

Item : Sales Analysis : Display : Sales Analysis

Item : Purchase Analysis : P : Display : Purchase Analysis

Here, the options ‘Sales Analysis’ and ‘Purchase Analysis’ are added to the ‘Gateway of Tally’ Menu. For the option ‘Purchase Analysis’, the character ‘P’ is explicitly specified as a hot key.

Attributes of Interface Definitions

Frequently used attributes of interface definitions like Report, Form, Part, Line and Field, are explained in this section.

Report Definition Attributes

Form

Every report requires one or more Forms. If there are more than one forms, then the first form is displayed by default. When one is in ‘Print’ mode, all the forms will be printed one after the other.

Syntax

Form : <Form Name>

Example

[Report : HW Report]

Form : HW Form

This code defines the report ‘HW Report’, using the form HW Form. If one chooses a Report that has no Forms defined, Tally.ERP 9 assumes that the Form Name is the same as the Report Name and looks for it. If it exists, Tally.ERP 9 displays it. Otherwise, Tally.ERP 9 displays an error message ‘Form :<Report Name> does not exist’.

Title

The ‘Title’ attribute is used to give a meaningful title to the Report.

Syntax

Title : <String or Formula>

By default, Tally.ERP 9 displays the name of the Report as Title, when it is invoked from the menu. If the ‘Title’ attribute is specified, then it overrides the default title.

Example

[Report : HWReport]

Form  : HWForm

Title : “Hello World”

Here, “Hello World” is displayed as the title of the Report, instead of HWReport.

Form Definition Attributes

Part/Parts

The attribute ‘Part’ defines Parts in a Form. ‘Part’ and ‘Parts’ are synonyms of the same attribute. It specifies the names of the Parts in a Form. By default, the Parts are aligned vertically.

Syntax

Part/Parts : <List of Part Names>

Example

[Form : HW Form]

Part : HW Title Partition, HW Body Partition

This code segment defines two parts, HW Title Partition and HW Body Partition , which are vertically aligned, starting from the top of the Form.

Part Definition Attributes

Line/Lines

This attribute specifies the Lines contained in a Part.

Syntax

Line/Lines : <list of line names>

Example

[Part : HW Part]

Line : HW Line1, HW Line2

Line Definition Attributes

Field/Fields

The attributes ‘Field’ and ‘Fields’ are similar. They start from the left of the screen or page, in the order in which they are specified.

Syntax

Field/Fields : <List of Field Names>

Example

[Line : HW Line]

Fields : HW Field

Set as

This attribute sets a value to the Field.

Syntax

Set as : <Text or Formula>

Example

[Field : HW Field]

Set as : ”Hello TDL”

Here, the text “Hello TDL” is displayed in the report.

Info

The attribute Info used to set text for prompts and titles as display strings. Even when used in Create/ Alter mode, this attribute does not allow the cursor to be placed on the current field, as against the attribute ‘Set as’. However, in Display mode, the attributes ‘Set as’ and ‘Info’ function similarly.

Syntax

Info : <Text or formula>

Further, if both the attributes (Set as and Info) are specified, the attribute Info gets the precedence, and the value set within the attribute Info overrides the value set within the attribute Set As.

Example

[Field: Name Field]

Use    : Name Field

Set as : "Tally"

Info   : "Tally Solutions"

Skip

This attribute causes the cursor to skip the particular field and hence, the value in the field cannot be altered by the user, even if the report is in ‘Create’ or ‘Alter’ mode.

Syntax

Skip : <Logical Formula>

Example

[Field : HW Field]

Type   : String

Set as : “Hello World“

Skip   : Yes

This code snippet sets the value in the ‘HW Field’ as ‘Hello World’ and forces the cursor to skip the field. It can also be rewritten as:

[Field : HW Field]

Type : String

Info : “Hello World“

Note: The attribute Info at Field combines both Skip and Set As.

Modifiers

Modifiers are used to perform a specific action on a definition or on an attribute. They are classified as Definition Modifiers and Attribute Modifiers, based on whether a definition or attribute is being modified. Definition Modifiers are #, ! and *. Attribute Modifiers are Use, Add, Delete, Replace/Change, Option, Switch and Local.

The modifiers can also be classified into two types, based on the mode of evaluation:

Static/Load time modifiers : Use, Add, Delete, Replace/Change

Dynamic/Real time modifiers : Option, Switch and Local

Static/Load time Modifiers

These modifiers do not require any condition at the run time. The value is evaluated at load time only and remains static throughout the execution. Use, Add, Delete, Replace are static modifiers.

Use

The USE Keyword is used in a definition to reuse an existing Definition.

Syntax

Use : <Definition Name>

Example

[Field : DSPExplodePrompt]

Use : Medium Prompt

All the properties of the existing field definition Medium Prompt are applicable to the field DSPExplodePrompt.

Add

The ADD modifier is used in a definition to add an attribute to the Definition.

Syntax

Add : <Attribute Name> [:<Attribute Position>:<Attribute Name>]:<Attribute Value>

Where,

< Attribute Name > is the name of the attribute specific to the particular definition type.

< Attribute Position > can be any one of the keywords Before, After, At Beginning and At End. By default, the position is At End.

< Attribute Value > can either be a constant or a formula.

Example

[#Form : Cost Centre Summary]

Add : Button : ChangeItem

A new button ChangeItem is added to the form Cost Centre Summary .

Example

[#Part : VCH Narration]

Add : Line : Before : VCH NarrPrompt : VCH ChequeName, VCH AcPayee

The lines ‘VCH ChequeName’ and ‘VCH AcPayee’ are added before the line ‘VCH NarrPrompt’ in the part ‘VCH Narration’.

Delete

The ‘Delete’ modifier is used in a definition to delete an attribute of the Definition.

Syntax

Delete : <Attribute Name> [:<Attribute Value>]

Where,

< Attribute Value > is optional, and can either be a constant or a formula. If the attribute value is omitted, all the values of the attribute are removed.

Example

[Form : Cost Centre Summary]

Use    : DSP Template

Delete : Button : ChangeItem

The button ‘ChangeItem’ is deleted from the form ‘Cost Centre Summary’. The functionality of the button ‘ChangeItem’ is no longer available in the form ‘Cost Centre Summary’. If the Button name is not specified, then all the buttons will be deleted from the Form.

Replace

The ‘Replace’ modifier is used in a definition to alter an attribute of the Definition.

Syntax

Replace : <Attribute Name> : <Old Attribute Value> : <New Attribute Value>

Where,

< Attribute Name > is the name of the attribute specific for the particular definition type.

< Old Attribute Value > and < New Attribute Value > can be either a constant or a formula.

Example

[Form : Cost Centre Summary]

Use     : DSP Template

Replace : Part : Part1 : Part2

The part ‘Part1’ of form ‘Cost Centre Summary’ is replaced by the part ‘Part2’. Now, only the properties of ‘Part2’ are applicable.

Dynamic/Real time modifiers

Dynamic modifiers get evaluated at the run time based on a condition. These modifiers are run every time the TDL is executed in an instance of Tally. ‘Option’, ‘Switch’ and ‘Local’ are the Dynamic modifiers.

Local

The ‘Local’ attribute is used in the context of the definition to set the local value within the scope of that definition only.

Syntax

Local : <Definiti o n Name> : <Old Attri b ute Value>: <New Attr i bute Value>

Example

Local : Field : Name Field : Set As : #StockItemName

Value of the formula #StockItemName is now the new value for the attribute Set As of the field Name Field applicable only for this instance. Elsewhere, the value will be as in the field definition.

Option

Option is an attribute which can be used by various definitions, to provide a conditional result in a program. The ‘Option’ attribute can be used in the ‘Menu’, ‘Form’, ‘Part’, ‘Line’, ‘Key’, ‘Field’, ‘Import File’ and ‘Import Object’ definitions.

Syntax

Option : <Optional definition> : <Logical Condition>

Where,

< Modified Definition > is the name of a definition, defined as optional definition using the definition modifier !.

If the ‘Logical’ value is set to TRUE, then the Optional definition becomes a part of the original definition, and the attributes of the original definition are modified based on this definition.

Example

[Field : FldMain]

Option : FldFirst : cond1

Option : FldSecond : cond2

The field FldFirst is activated when cond1 is true. The field FldSecond is activated when cond2 is true. Optional definitions are creat e d with the symbol prefix " ! " as f o llows:

[!Field : FldFirst]

[!Field : FldSecond]

Switch - Case

The ‘Switch - Case’ attribute is similar to the ‘Option’ attribute, but reduces the code complexity and improves the performance of the TDL Program.

The ‘Option’ attribute compulsorily evaluates all the conditions for all the options provided in the description code, and applies only those which satisfy the evaluation conditions.

The attribute ‘Switch’ can be used in scenarios where evaluation is carried out only till the first condition is satisfied.

Apart from this, ‘Switch’ statements can be grouped using a label. Therefore, multiple switch groups can be created, and zero or one of the switch cases could be applied from each group.

Syntax

Switch : Label : Desc name : Condition

Example

[Field : Sample Switch]

Set as : "Default Value"

Switch : Case1 : Sample Switch1 : ##SampleSwitch1

Switch : Case1 : Sample Switch2 : ##SampleSwitch2

Switch : Case1 : Sample Switch3 : ##SampleSwitch3

Switch : Case2 : Sample Switch4 : ##SampleSwitch4

Sequence of Evaluation – Attributes

The order of evaluation of the attributes is as specified below:

Use

Normal Attributes

Add/Delete/Replace

Option

Switch

Local

Delayed Attributes

Add/Delete/Replace are referred to as Delayed attributes because even if they are specified within the definition in the beginning, their evaluation will be delayed till the end, within the static modifier and normal attributes.

Actions in TDL

TDL is an action-driven language. Actions are activators of specific functions with a definite result. Actions are performed on two principal definition types, ‘Report’ and ‘Menu’. An action is always associated with an originator, requestor and an object. All the actions originate from the Menu, Key and Button.

An action is evaluated in the context of the Requestor and Object. Typically, actions are initiated through the selection of a Menu item or through an assignment to a Key or a Button. Examples of actions are: Display, Menu, Print, Create, Alter, etc.

Syntax

Action : <Action Name> [: <Definition/Variable Name> : Formula]

Where,

< Action Name > is the name of action to be performed. It can be any of the pre-defined actions.

< Definition/Variable Name > is the name of definition/variable, on which the action is performed.

Example

Action : Create : My Sample Report

Data Types

The Data Types in TDL specify the type of data stored in the field. TDL, being a business language, supports business data types like amount, quantity, rate, etc., apart from the other basic types. The data types are classified as Simple Data Types and Compound Data Types.

Simple Data Type

This holds only one type of data. These data types cannot be further divided into sub-types. String, Number, Date and Logical data types fall in this category.

Compound Data Type

It is a combination of more than one data type. The data types that form the Compound Data Type are referred to as sub-data types. The Compound Data types in TDL are: Amount, Quantity, Rate, Rate of exchange and Aggregate.

Data Types

S ub-Typ e s

Simple Data Types

Number

String

Date

Logical

Compound Data Types

Amount

Base/Direct Base

Forex

Rate Of Exchange

DrCr

Quantity

Number

Primary Units/Base Units

Secondary Unit/Alternate Uni t s/Tail Units

Rate

Price

Unit Symbol

Rate of Exchange

The type for the field definition is specified using the Type attribute.

Syntax

[Field : <Field Name>]

Type : <Data type> : <Sub-type>

Example

[Field: Qty Secondary Field]

Type : Quantity : Secondary Units

Note: For the Date data type, valid dates are in the range 1-1-1901 to 31-12-2098. Dates outside this range can be stored in string fields to perform the required calculations using user defined functions.

Operators in TDL

Operators are special symbols or keywords that perform specific operations on one, two or three operands and then return a result. The four types of operators in TDL are as follows:

Arithmetic Operators

+

Addition

-

Subtraction

/

Division

*

Multiplication

Logical Operators

The logical operators used are: OR, AND,NOT, TRUE/ON/YES and FALSE/OFF/NO

OR

Returns TRUE if either of the expressions is True.

AND

Returns TRUE when both the expressions are True.

NOT

Returns TRUE, if the expression value is False and FALSE, when expression value is True.

TRUE/ON/YES

Can be used to check if the value of the expression is TRUE.

FALSE/OFF/NO

Can be used to check if the value of the expression is FALSE.

Comparison Operators

A Comparison Operator compares its operands and returns a logical value based on whether the comparison is True. The Comparison Operator returns the value as TRUE or FALSE. TDL supports the following Comparison Operators:

= /Equal/Equals

Checks if the values of both the expressions are equal.

</LessThan/Lesser Than/Lesser

Checks if the value of <ex p ression 1> is less than the value of <expression 2>.

>/Greater Than/More

Checks if t he val u e of <expression 1> is greater than the value of <expression 2>.

In

Checks if the value is in the List of c o mma se p arated val u es.

Null

Checks whether the e xpression is Em p ty.

Between …. And

Checks if the expression value is in the range.

String Operators

String operators facilitate the comparison of two strings. The following are the String operators:

Contains/Containing

Checks if the expression contains the given string.

Starting With/Beginning With/Starting

Checks if the expression starts with the given string.

Ending With/Ending

Checks if the expression ends with the given string.

Like

Checks if the expression matches with the given string pattern.

Special Symbols

The Symbol Prefix in Tally Definition Language (TDL) has different usage and behaviour, when used with different definitions and attributes of definitions.

Special Symbols used in TDL are $, $$, @, @@, #, ##, ;, ;;, ;;;, /* */, + , ! , * and _ . Each of these symbols are used for a specific purpose. The usage of each of these symbols will be discussed in detail in the subsequent chapters.

Functions

A function is a small code which accepts a certain number of parameters, performs a task and returns the result. The function may accept zero or more arguments, but returns a value.

The functions in TDL are defined and provided by the platform. These functions are meant to be used by the TDL programmer and are specifically designed to cater to the business requirement of the Tally.ERP 9 application.

TDL has a library of functions which allows performing string, date, number and amount related operations apart from the business-specific tasks. Some of the basic functions provided by TDL are $$StringLength, $$Date, $$RoundUp, $$AsAmount. TDL directly supports a variety of business related functions such as $$GetPriceFromLevel, $$BillExists, $$ForexValue, etc.

Syntax

$$<Function Name> : <Argument List>

Example

$$SysName:EndOfList

Here, the function $$SysName returns TRUE , if the parameter passed is a TDL reserved string.

Learning Outcome

In a TDL program, the ‘Report’ and ‘Menu’ definitions can exist independently.

The hierarchy of definitions in a TDL program are as follows:

o Report uses a Form

o Form uses a Part

o Part uses a Line

o Line uses a Field and

o A Field is where the contents are displayed or entered.

The Report is called either from a Menu or from a Key Event.

TDL consists of Definitions , Attributes , Modifiers , Data Types , Operators , Symbols & Prefixes , and Functions .