You are on page 1of 8

Tally Technology

The Complete Reference

Preface
This is an era of Domain Specific Languages(DSLs). Well-designed DSLs have been quite
valuable with programmers operating in a specific domain. These prove particularly worthwhile from the point of view of improvements in productivity and faster implementation
cycles.
The heart and crux of Tally Technology is the DSL-Tally Definition Language (TDL) which
has been there from the advent of Tally version 5.4 during the late 90s i.e., around 1995-96.
The language used in development of Tally, predominantly made its presence felt with
business programmers who opted for developing customizations and extensions on Tally.
Over the years, major advancements in Tally Technology resulted in transformation of Tally as
a complete Application Development Platform. The developments in TDL resulted in capabilities for rapid development, rendering, data management and integration. The Tally Definition
Language (TDL) along with the development suite Tally.Developer 9(TD 9) provides the
strong technology backbone for developing solutions on Tally platform.
This book provides a comprehensive coverage of Tally technology starting from the basic
understanding of Tally architechture to in-depth concepts, usage and implementation scenarios
using TDL. With each chapter you will find explanations for topics along with syntax and
examples substantiating the content. The exercises provided give a good hands-on experience
for the concepts learnt.
The preliminary chapters from 1 through 5 mainly focus on the various components of the
language along with user interface design elements. The chapters 6 through 11 provide the
core capability coverage on the basis of which Tally is termed as an Application Development Platform. The chapters 6. Objects, Collections and Internal Object Structure,
8. Object Manipulation and Storage in TDL and 11. User Defined Fields, Validation and
Controls emphasize solely on data storage, manipulation and retrieval methodologies using
the user interface. The chapters 7. Actions, Event Framework and Key Definition and 9.
TDL Procedural Capabilities cover concepts which make TDL a true action and event driven
language with procedural capabilities augmenting its power. The chapter 10. Variable Framework helps in understanding the usage of various types of variables available in TDL. The
chapter 12. Advanced Reporting and Printing will take you through the various reporting
and printing techniques. The various techniques aid in development of simple tabular reports
to complex columnar reports which provide a strong foundation in the area of MIS reporting.
Towards the end you will find various use cases which will give you an insight on various
implementation scenarios emphasizing on the application of concepts covered. By the time
you complete the book you are ready to undertake the project work Inventory ManagementGarment Store and dive into the over expansive world of Tally Technology.

Table of Contents
Chapter 1:
1.1
1.2
1.3

1.4
1.5
1.6

1.7

1.8

1.9
Chapter 2:
2.1
2.2
2.3

2.4
2.5

Tally Technology An Overall Perspective


Introduction ............................................................................................................................... 1
Need for Tally Extensions ............................................................................................ 2
The Domain Specific Language TDL........................................................................ 4
1.3.1 Definition Language .......................................................................................................... 4
1.3.2 Action Driven Language with Procedural Capabilities .................................................... 4
1.3.3 Completely Object Oriented .............................................................................................. 4
Tally As a Development Platform ..................................................................................... 5
1.4.1 Rapid Development ............................................................................................................ 5
1.4.2 Flexibility ........................................................................................................................... 6
Components of a TDL program .......................................................................................... 6
1.5.1 Underlying Tally Technology ............................................................................................ 8
Tally Architecture Overview ............................................................................................. 9
1.6.1 The Application/Tally.ERP 9 Layer ................................................................................. 10
1.6.2 The TDL Language and Interpreter Layer ...................................................................... 10
1.6.3 Platform Layer/Engine ..................................................................................................... 10
Tally Technology Capabilities .......................................................................................... 12
1.7.1 Solution-ability & Customizability .................................................................................. 12
1.7.2 Multiple Output Capability .............................................................................................. 12
1.7.3 Data Management Capability .......................................................................................... 12
1.7.4 Integrate-ability ............................................................................................................... 13
Tally Development Environment ........................................................................................ 13
1.8.1 Getting Started with TD 9 ................................................................................................ 15
1.8.2 Usage of Different Explorer Windows ............................................................................. 16
1.8.3 Usage of different Browsers and Property Window ........................................................ 16
1.8.4 Coding Convention .......................................................................................................... 17
1.8.5 Navigating and understanding the Tally Source Code(Default TDL project) ................. 18
1.8.6 Folder Structure and File naming convention ................................................................. 18
1.8.7 Navigating and Searching project Default TDL .............................................................. 18
TDL Program Life Cycle ...................................................................................................... 18

Definitions, Attributes and Modifiers


Introduction ............................................................................................................................. 23
Definitions ............................................................................................................................... 23
2.2.1 Definition Categorization ................................................................................................ 24
Attributes ................................................................................................................................. 32
2.3.1 List Type Attribute ............................................................................................................ 33
2.3.2 Attribute Feature Discreteness ..................................................................................... 34
2.3.3 Classification of Attributes .............................................................................................. 35
2.3.4 Predefined Attribute Values in TDL ................................................................................ 39
Aliases for Definitions and Attributes ................................................................................ 39

Definition Default ............................................................................................................... 40

Table of Contents
2.6

Chapter 3:
3.1
3.2

Modifiers ................................................................................................................................. 42
2.6.1 Definition Modifiers ......................................................................................................... 42
2.6.2 Attribute Modifiers ........................................................................................................... 43

Datatypes, Operators and Expressions


Introduction ............................................................................................................................. 55
Data Types .............................................................................................................................. 55
3.2.1
3.2.2
3.2.3
3.2.4

3.3

3.4
Chapter 4:
4.1
4.2

Simple Data Types ........................................................................................................... 56


Compound Data Type ...................................................................................................... 57
Data Type Formats .......................................................................................................... 60
Data Conversion (Type Casting) ..................................................................................... 64
Operators in TDL ................................................................................................................... 70
3.3.1 Unary Operators .............................................................................................................. 70
3.3.2 Arithmetic Operators ....................................................................................................... 71
3.3.3 Logical Operators ............................................................................................................ 72
3.3.4 Comparison Operators .................................................................................................... 75
3.3.5 String Operators .............................................................................................................. 77
3.3.6 Operator Precedence ....................................................................................................... 78
3.3.7 Data Types supported by Arithmetic Operators .............................................................. 79
Expressions in TDL ............................................................................................................... 83

Access Specifiers and Special Symbols


Introduction ............................................................................................................................. 85
Access Specifiers ................................................................................................................... 86
4.2.1
4.2.2
4.2.3
4.2.4
4.2.5
4.2.6
4.2.7
4.2.8

4.3
4.4
4.5

4.6

ii

Usage of @ and @@ ....................................................................................................... 86


Naming Conventions for Formulae ................................................................................. 86
Classification of Formulae .............................................................................................. 86
Accessing a Local Formula using @ ............................................................................... 87
Accessing of Global Formula using @@ ........................................................................ 87
The Usage of # ................................................................................................................. 88
The Usage of ## ............................................................................................................... 88
Usage of $ and $$ ............................................................................................................ 92
Overview of a Method .......................................................................................................... 92
4.3.1 Accessing Method value using $ ...................................................................................... 93
Functions in TDL ................................................................................................................... 93
4.4.1 Accessing a Function using $$ ....................................................................................... 93
Frequently used functions in TDL .................................................................................... 101
4.5.1 Type Casting Functions ................................................................................................. 101
4.5.2 Mathematical Functions ................................................................................................ 103
4.5.3 Logical Functions .......................................................................................................... 104
4.5.4 Date Functions ............................................................................................................... 106
Special Symbols ................................................................................................................... 110
4.6.1 Usage as Definition Modifiers ....................................................................................... 110
4.6.2 Usage as Code Differentiators ...................................................................................... 112
4.6.3 Usage in ODBC Context ................................................................................................ 114

Table of Contents
4.7
Chapter 5:
5.1
5.2
5.3

Valid Expressions in TDL .................................................................................................. 115

Dimensions, Formatting and Report Layouts


Introduction ........................................................................................................................... 119
Units of Measurement ......................................................................................................... 119
Dimensional Attributes ....................................................................................................... 120
5.3.1
5.3.2
5.3.3
5.3.4

5.4

5.5
5.6
5.7

Sizing/ Size Attributes .................................................................................................... 120


Spacing/ Position Attributes .......................................................................................... 127
Alignment Attributes ...................................................................................................... 132
Some Specific Attributes ................................................................................................ 146
Definitions and Attributes for Formatting ....................................................................... 150
5.4.1 Border ............................................................................................................................ 150
5.4.2 Style ................................................................................................................................ 152
5.4.3 Color .............................................................................................................................. 154
Color, Background, PrintFG and PrintBG Attribute ...................................................... 157

Format Attribute ................................................................................................................... 159


Report Layouts in Tally.ERP 9 .......................................................................................... 160
5.7.1 Tabular Report Eg: Ledger Vouchers ......................................................................... 160
5.7.2 Columnar Report Eg: Sales Register ......................................................................... 161
5.7.3 Designing a Hierarchical Report Eg: Trial Balance .................................................. 162

Chapter 6:
6.1
6.2
6.3

6.4

6.5

6.6

6.7

Objects, Collections and Internal Object Structure


Introduction ........................................................................................................................... 165
Objects In General ............................................................................................................ 165
6.2.1 Tally Object Structure .................................................................................................... 166
6.2.2 Object Types ................................................................................................................... 168
Collections ............................................................................................................................. 170
6.3.1 Simple and Compound Collection ................................................................................. 171
6.3.2 Populating a Collection ................................................................................................. 171
6.3.3 Dynamic Objects ............................................................................................................ 181
Methods ................................................................................................................................. 186
6.4.1 Internal Methods ............................................................................................................ 186
6.4.2 User Defined / External Methods .................................................................................. 187
6.4.3 Object Association ......................................................................................................... 187
Object Context ...................................................................................................................... 198
6.5.1 Accessing Methods ......................................................................................................... 199
6.5.2 Data Object Context Switching ...................................................................................... 208
6.5.3 Interface Object Context Switching ............................................................................... 219
Collection Capabilities ........................................................................................................ 224
6.6.1 Basic Capabilities .......................................................................................................... 225
6.6.2 Grouping & Aggregation ............................................................................................... 236
6.6.3 Usage as Tables ............................................................................................................. 255
6.6.4 Collection Functions Data Retrieval & Filtering ....................................................... 262
Voucher Object Structure ................................................................................................... 268

iii

Table of Contents
Chapter 7:
7.1
7.2

Action, Event Framework and Key Definition


Introduction ........................................................................................................................... 273
Action Framework ............................................................................................................... 273
7.2.1
7.2.2
7.2.3
7.2.4
7.2.5
7.2.6
7.2.7

7.3
7.4

Chapter 8:
8.1
8.2

8.3
8.4
Chapter 9:
9.1
9.2
9.3
9.4

9.5
9.6

iv

Understanding Actions .................................................................................................. 273


Action Association ......................................................................................................... 282
Classification of Predefined Actions ............................................................................. 292
Action Execution & Evaluation Process ........................................................................ 293
Scope of Actions ............................................................................................................. 295
Dynamic Actions ............................................................................................................ 299
Frequently used System and Object Specific Actions .................................................... 302
Key Definition ...................................................................................................................... 316
7.3.1 Attributes of the Definition Button / Key ....................................................................... 318
Event Frame Work ............................................................................................................... 323
7.4.1 Understanding TDL Events ........................................................................................... 324
7.4.2 Different Types of Events In TDL .................................................................................. 324

Object Manipulation and Storage in TDL


Introduction ........................................................................................................................... 333
Object Manipulation using the Tally Interface(Field, Report & Menu) ..................... 334
8.2.1 Field Attribute Storage ............................................................................................... 334
8.2.2 Data Object Association Report level ......................................................................... 335
8.2.3 Actions for Object Manipulation(Creation and Alteration) .......................................... 335
Object Manipulation using TDL/User Defined Functions (Procedural Capabilities) 352

Object Manipulation using Data gathered from External Data Sources .................... 353

TDL Procedural Capabilities


Introduction ........................................................................................................................... 355
Functions In TDL ............................................................................................................. 355
9.2.1 In Built/Platform Defined Functions ............................................................................. 356
9.2.2 User Defined TDL Procedures/Functions ..................................................................... 356
Function Building Blocks ............................................................................................... 360
9.3.1 Definition Block ............................................................................................................. 361
9.3.2 Procedural Block ........................................................................................................... 365
Function Execution Object Context .............................................................................. 365
9.4.1 Target Object Context .................................................................................................... 365
9.4.2 Parameter Evaluation Context ...................................................................................... 366
9.4.3 Return Value Evaluation ................................................................................................ 366
Valid Statements Inside Functions ................................................................................ 367
9.5.1 Programming Constructs ............................................................................................... 367
9.5.2 Actions ........................................................................................................................... 385
File Input/Output Capability .............................................................................................. 402
9.6.1 Source File Context ....................................................................................................... 403
9.6.2 Target File Context ........................................................................................................ 403

Table of Contents
9.6.3
9.6.4
9.6.5
9.6.6
9.6.7

Chapter 10:

File Operations .............................................................................................................. 403


Generic File Operations ................................................................................................ 404
Generic Functions .......................................................................................................... 406
Read/Write Operation on Text Files .............................................................................. 408
Read/Write Operation on Excel Files ............................................................................ 412

Variable Framework

10.1 Introduction ........................................................................................................................... 423


10.2 The Concept .......................................................................................................................... 423
10.2.1 Types of Variable ......................................................................................................... 423

10.3 The Usage .............................................................................................................................. 424


10.3.1 Variable Definition and Attributes ............................................................................... 424
10.3.2 Variable Declaration and Scope .................................................................................. 432
10.3.3 Using Modifiers with Variables ................................................................................... 442
10.3.4 List Variable Manipulations ........................................................................................ 443
10.3.5 Field Acting as a Variable ........................................................................................... 475
10.3.6 Implication of Repeat Variables in Columnar Report ................................................. 476
10.3.7 Common Functions used with Columnar Reports ....................................................... 478
10.3.8 Variables usage and behaviour in Auto Report ........................................................... 481
10.3.9 Repeat Line with Optional Collection .......................................................................... 483
10.3.10 Variables in Collection .............................................................................................. 491
10.3.11 Collection from a Variable ........................................................................................ 491
10.3.12 Variables in Remoting ................................................................................................ 492

Chapter 11:

User Defined Fields, Validation and Controls

11.1 Introduction ........................................................................................................................... 495


11.2 User Defined Fields ............................................................................................................. 495
11.2.1
11.2.2
11.2.3
11.2.4

UDF Definition ............................................................................................................ 496


Storing Values into a UDF .......................................................................................... 497
Retrieving values from a UDF ..................................................................................... 497
UDF Types ................................................................................................................... 498
11.3 Validation and Controls ...................................................................................................... 512
11.3.1 Field Level Attributes ................................................................................................... 512
11.3.2 Form Level Attributes .................................................................................................. 515
11.3.3 Menu Level Attribute .................................................................................................... 516
11.3.4 Report Level Attribute .................................................................................................. 517

Chapter 12:

Advanced Reporting and Printing

12.1 Introduction ........................................................................................................................... 523


12.2 Advanced Reporting ............................................................................................................ 523
12.2.1 Tabular Reports ........................................................................................................... 523
12.2.2 Columnar Reports ........................................................................................................ 541
12.3 Printing ................................................................................................................................... 575
12.3.1 Modes of Printing / Printing Formats ......................................................................... 576
12.3.2 Report Printing / Printing Techniques ......................................................................... 577

Table of Contents
12.3.3
12.3.4
12.3.5
12.3.6
12.3.7
12.3.8

Page breaks ................................................................................................................. 587


Multi Page/Part Printing ............................................................................................. 600
Printing on a Pre Printed Stationary ........................................................................... 604
Printing related Events Before Print/After Print ...................................................... 605
Image Printing ............................................................................................................. 605
Additional Attributes and Functions ............................................................................ 609

Project Work: Inventory Management Garment Store


1 F11 Features ............................................................................................................................... 619
2 Stock Item Master Creation ..................................................................................................... 621
3 Voucher Type Master Alteration ............................................................................................. 625

5
6

7
8

3.1 Purchase Voucher Type Creation ..................................................................................... 625


3.2 Sales Voucher Type Creation ........................................................................................... 626
3.3 Implementation Logic ....................................................................................................... 626
Voucher Entry ............................................................................................................................ 627
4.1 Garment Purchase Voucher ............................................................................................. 627
4.2 Implementation Logic ....................................................................................................... 628
4.3 Garment Sales Voucher .................................................................................................... 629
4.4 Implementation Logic ....................................................................................................... 629
Invoice ......................................................................................................................................... 630
5.1 Implementation Logic ....................................................................................................... 631
Garment Store Reports .................................................................................................. 631
6.1 Stock Summary with Brand/Type/Colour/Size (Existing Report - Stock Summary) ......... 631
6.2 Instructions for Filtering .................................................................................................. 631
6.3 Implementation Logic ....................................................................................................... 631
6.4 Instructions for Filtering .................................................................................................. 632
6.5 Implementation Logic ....................................................................................................... 632
Columnar Reports ....................................................................................................................... 633
7.1 Brandwise Itemwise Sizewise Sales (New Report) ........................................................... 633
7.2 Implementation Logic ....................................................................................................... 633
Color Scheme ............................................................................................................................. 634

Use Cases
1
2
3
4
5
6
7

vi

Use Case I Import from Excel/Text .................................................................................... 637


Use Case II Multiple Saved Configurations for Report .................................................. 646
Use Case III Multiple Email Configurations ..................................................................... 654
Use Case IV Duplicating Vouchers .................................................................................... 660
Use Case V Inter Company Data transfer .......................................................................... 664
Use Case VI Multi Company Outstanding Report ........................................................... 669
Use Case VII Voucher and Invoice Customization .......................................................... 673

You might also like