text
stringlengths 0
5.42k
| source
stringclasses 1
value |
---|---|
TDL Reference Manual | TDL_Reference_Manual.pdf |
The information contained in thi s document represents the curre nt view of T ally Solutions Pvt. Ltd., ('T ally' in short) on the topics discussed as of the date of publication. Because T ally must res pond to changing market conditions, it should not be interprete d to be a commitment on the part of T ally, and T ally cannot guarantee the accuracy of any information presented after the date of public ation. This document is for informational purposes only. T ALL Y MAKES N O W ARRANTIES, EXPRESS O R IMPLIED, IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibil ity of the user. Without limiting the rights under copyright, n o part of this document may be reproduced, stored in, or introduced into a retrieval system, or transmitt ed in any form, by any means (e lectronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of T ally Soluti ons Pvt. Ltd. T ally may have patents, patent applications, trademarks, copyri ghts, or other intellectual prope rty rights covering subject ma tter in this document. Except as expressly provided in any written licence a greement from T ally, the furnishing of this document does not g ive you any licence to these patents, trademarks, copyrights, or other intellectual property. © 2017 T ally Solutions Pvt. Ltd. All rights reserved. T ally, T ally 9, T ally9, T ally. ERP, T ally. ERP 9, T ally. Server 9, Shoper, Shoper 9, Shoper POS, Shoper HO, Shoper 9 POS, Shoper 9 HO, T ally Developer, T ally Developer, T ally. Developer 9, T ally. NET, T ally Development Environment, T ally Extender, T ally Integrator, T ally Integrated Network, T ally Service Partner, T ally Academy & Power of Simplicity are either registered trademarks or tradem arks of T ally Solutions Pvt. Ltd. in Indi a and/or other countries. All other trademarks are propertie s of their respective owners. Ve r s i o n : TDL Reference Manual/April 2017 | TDL_Reference_Manual.pdf |
Preface T ally Definition Language (TDL) is the development of T ally. ERP 9. This allows the programmers to develop and deploy faster, effective T ally Extensions with ease. The book, TDL Reference Manual, divided into two sections. Firs t section begins with the Introduction to TDL and focuses on basic concepts of TDL i. e, TDL Components, Symbols used in TDL, Dimensions and Formatting, Usage of V ariables, Buttons and Keys. Thereafter the emphasis is on the coverage of core concepts of Objects, Methods and Collections, Actions and UDF creation. After gaining a reasonable amount of depth and confidence in understanding the above, the focus of the book progresses towar ds the application of all covered topics i. e., the creation of various types of Reports, Printing and Voucher/Invoice customisations. Second section devoted to a detailed discussion of TDL language enhancements for T ally. ERP 9. This section describes the new features, Writing Remote Complia nt TDL Reports and User Defined Functions respectively. The What's new section gives an insight about the enhancements i n t h e latest T ally. ERP 9 Releases. This book is for anyone who wants to explore TDL as a developme nt language of T ally and how to write TDL programs effectively. Absolutely no previous TDL experience is necessary. E v e n advanced users will find this book useful, as the changes to TD L are dealt from the developers and the user's point of view. Y ou will enjoy reading this book, as it is rich in concepts. Happy programming folks! | TDL_Reference_Manual.pdf |
TDL_Reference_Manual.pdf |
|
i Contents Tally Definition Language-An Introduction Tally Definition Language.................................................................................................................... 4 Comparison with other Languages...................................................................................................... 4 The TDL Program-At a Glance.......................................................................................................... 6 TDL Capabilities.................................................................................................................................. 7 TDL Features....................................................................................................................................... 7 TDL Components Writing a Basic TDL Progra m.............................................................................................................. 9 Steps to create a TDL Program........................................................................................................... 9 Specification of TDL Files................................................................................................................... 9 Executing Multiple Files using Include Definition................................................................................. 11 TDL Interfaces................................................................................................................................... 11 'Hello TDL' Program.......................................................................................................................... 12 TDL Components.............................................................................................................................. 13 Definitions....................................................................................................................................... 13 Attributes........................................................................................................................................ 16 Modifiers......................................................................................................................................... 20 Actions in TDL................................................................................................................................. 24 Data Types..................................................................................................................................... 25 Operators in TDL............................................................................................................................. 2 6 Special Symbols.............................................................................................................................. 27 Functions........................................................................................................................................ 28 Symbols and Prefixes Access Specifiers/Symbol Prefixes................................................................................................... 29 General Symbols............................................................................................................................... 30 The Usage of @ and @@................................................................................................................. 30 Defining a Local Formula using @..................................................................................................... 30 Defining a Global Formula using @@................................................................................................ 31 The Usage of # and ##...................................................................................................................... 31 Referencing a Field using #.............................................................................................................. 32 Modifying existing Definitions using #................................................................................................. 32 Accessing value from a Variable using ##.......................................................................................... 32 The Usage of $ and $$...................................................................................................................... 33 Accessing a Method using $............................................................................................................. 33 Calling an Internal Function using $$................................................................................................. 33 Commenting a Code using ;, ;; and /**/............................................................................................. 34 Line Continuation Character (+)........................................................................................................ 34 | TDL_Reference_Manual.pdf |
ii Exposing Methods and Creating Procedures (_ )............................................................................... 34 Reinitialize Definitions (*)................................................................................................................... 35 Optional Definitions (!)....................................................................................................................... 35 Dimensions and Formatting Unit of Measurement......................................................................................................................... 39 Dimensional Attributes....................................................................................................................... 39 Sizing/Size Attributes....................................................................................................................... 39 Spacing/Position Attributes............................................................................................................... 41 Alignment Attributes......................................................................................................................... 42 Some Specific Attributes................................................................................................................... 46 Inactive........................................................................................................................................... 46 Invisible.......................................................................................................................................... 46 Definitions and Attributes for Formatting........................................................................................... 47 Definition-Border............................................................................................................................ 47 Definition-Style.............................................................................................................................. 48 Definition-Color.............................................................................................................................. 50 Attributes 'Backgroun d' and 'Print BG'................................................................................................ 50 Attribute-Format............................................................................................................................. 5 1 Variables, Buttons and Keys Variable............................................................................................................................................. 55 Attributes of a Variable..................................................................................................................... 55 The Scope of a Variable................................................................................................................... 57 Modifying the Variable Value............................................................................................................. 59 Example-Variables......................................................................................................................... 60 Buttons and Keys.............................................................................................................................. 60 Attributes of Buttons/Keys................................................................................................................. 61 Objects and Collections Objects.............................................................................................................................................. 63 Tally Object Structure....................................................................................................................... 63 Tally Objects Types......................................................................................................................... 65 Object Context................................................................................................................................ 68 Collections......................................................................................................................................... 69 Types of Collection.......................................................................................................................... 70 Sources of Collection....................................................................................................................... 71 Creating a Collection........................................................................................................................ 71 Object Association............................................................................................................................. 73 Report Level Object association........................................................................................................ 73 Part Level Object Association........................................................................................................... 74 Line Level Object Association........................................................................................................... 76 Field Level Object Association.......................................................................................................... 77 | TDL_Reference_Manual.pdf |
ii i Methods............................................................................................................................................. 77 Types of Methods............................................................................................................................ 77 Accessing Methods.......................................................................................................................... 77 Collection Capabilities....................................................................................................................... 80 Basic Capabilities............................................................................................................................ 80 Advanced Capabilities...................................................................................................................... 87 Actions in TDL Categories of Actions........................................................................................................................ 93 Action Association........................................................................................................................... 94 Components of Actions..................................................................................................................... 96 Global Actions................................................................................................................................... 97 Action-Menu.................................................................................................................................. 97 Action-Modify Object...................................................................................................................... 99 Action-Browse URL...................................................................................................................... 100 Actions-Create and Alter............................................................................................................... 101 Actions-Create Collection, Display Collection and Alter Collection..................................................... 104 Object Specific Actions.................................................................................................................... 106 Menu Actions-Menu Up, Menu Down, Menu Reject........................................................................ 106 Form Actions-Form Accept, Form Reject, Form End........................................................................ 106 Part Actions-Part Home, Part End, Part Pg Up............................................................................... 107 Line Actions-Explode, Display Object, Alter Object.......................................................................... 108 Field Actions-Field Copy, Field Paste, Field Erase, Calculator.......................................................... 109 User Defined Fields What is UDF?.................................................................................................................................. 111 Creating a UDF............................................................................................................................. 1 11 Storing User Inputs in the UDF........................................................................................................ 112 Retrieving the value of UDF from an Object...................................................................................... 112 Classification of UDF's.................................................................................................................... 112 Simple UDF.................................................................................................................................. 112 Aggregate UDF............................................................................................................................. 1 14 Reports, Printing and Validation Controls Reports............................................................................................................................................ 119 Tabular Reports............................................................................................................................. 1 19 Hierarchical Report (Drill down Report)............................................................................................ 124 Column Based Reports.................................................................................................................. 127 Printing............................................................................................................................................ 139 Menu Action-Print/Print Collection................................................................................................. 140 Button Action-Print Report............................................................................................................ 140 Page Breaks................................................................................................................................. 141 Frequently Used Attributes and Functions........................................................................................ 144 | TDL_Reference_Manual.pdf |
iv Validation and Controls................................................................................................................... 146 Field Level Attribute-Validate......................................................................................................... 146 Field Level Attribute — Unique........................................................................................................ 147 Field Level Attribute — Notify.......................................................................................................... 147 Field Level Attribute-Control.......................................................................................................... 148 Form Level Attribute-Control......................................................................................................... 148 Menu Level Attribute-Control......................................................................................................... 149 Report Level Attribute-Family........................................................................................................ 149 Voucher and Invoice Customisation................................................................................................. 151 Classification of Vouchers............................................................................................................... 151 Accounting Vouchers..................................................................................................................... 151 Inventory Vouchers........................................................................................................................ 152 Accounting-cum-Inventory Vouchers................................................................................................ 152 The Structure of a Voucher Object.................................................................................................. 152 Customisation.................................................................................................................................. 154 Voucher Customisation.................................................................................................................. 154 Invoice Customisation.................................................................................................................... 162 Writing Remote Compliant TDL Reports Client/Server Architecture-A n Overview....................................................................................... 176 Tally Client/Server Arch itecture using Tally Software Services....................................................... 176 Tally. NET Server........................................................................................................................... 176 Tally. ERP 9 Server........................................................................................................................ 177 Tally. ERP 9 Client......................................................................................................................... 177 Setting up Tally. NET Server fo r Remote Access............................................................................. 178 Setting up the Client Tally................................................................................................................ 179 TDL-In a Client/Server Envi ronment............................................................................................. 180 TDL Enhancements for Remote...................................................................................................... 181 Collection Enhancements............................................................................................................... 181 Report Level Enhancements........................................................................................................... 184 Function on Request...................................................................................................................... 188 Action Enhancements.................................................................................................................... 189 Writing Remote Compliant TDL Reports......................................................................................... 191 Fetching the single Object.............................................................................................................. 191 Repeating Lines over a Collection................................................................................................... 192 Using the same Collection in more than one Report.......................................................................... 194 General and Collection Enhancements Definition, Attribute and Modi fier Enhancements............................................................................ 19 5 Attribute Enhancements................................................................................................................. 195 Modifier Enhancements.................................................................................................................. 200 Behavioral change in System Definitions.......................................................................................... 203 | TDL_Reference_Manual.pdf |
v Partial Attribute Support................................................................................................................. 203 Change in usage of 'BLANK' Keyword in Menu Items........................................................................ 203 Enhanced Special Symbols............................................................................................................. 203 Multi-line commenting in TDL source code using /* and */................................................................ 2 0 3 Extension of modifying definitions using #........................................................................................ 204 '*' (Reinitialize) Definition modifier.................................................................................................... 204 Method Formula Syntax with Relative Object Specification............................................................ 204 Enhancements-Object Association................................................................................................ 206 Report Level Obje ct Association...................................................................................................... 206 Part Level Object Association......................................................................................................... 207 Line Level Object Association......................................................................................................... 208 Field Level Object Association........................................................................................................ 209 Enhancements-Object Access via Interface Object...................................................................... 210 Identifying Part and Line Interface object with 'Access Name'............................................................. 21 0 Value Extraction............................................................................................................................ 21 0 Bracket support in TDL.................................................................................................................... 212 During the Function Call................................................................................................................. 212 In the language syntax for nesting formulas...................................................................................... 213 As a Mathematical Operator........................................................................................................... 213 Action Enhancements...................................................................................................................... 214 Enhancements in Key Actions......................................................................................................... 214 New Actions.................................................................................................................................. 215 Events introduced............................................................................................................................ 222 Event-On Form Accept................................................................................................................ 222 Event-On Focus.......................................................................................................................... 222 User Defined Function..................................................................................................................... 223 New Functions................................................................................................................................. 223 Function-$$Is Object Belongs To...................................................................................................... 223 Function-$$Num Lines In Scope...................................................................................................... 224 Function-$$Date Range................................................................................................................ 224 Function-$$Is Coll Src Obj Changed.................................................................................................. 225 Function-$$Coll Src Obj................................................................................................................. 225 Enhanced Collection Capabilities.................................................................................................... 226 Aggregation and Reporting............................................................................................................. 226 The Summary Collection is available through Tally ODBC Interface.................................................... 238 HTTP XML Collection (GET and POST wi th and without Object Specification)..................................... 239 Usage As Tables........................................................................................................................... 245 Dynamic Object support for HTTP-XML Information Interchange........................................................ 249 Collection Capabilities for Re moting................................................................................................ 251 | TDL_Reference_Manual.pdf |
vi User Defined Functions Functions-In General.................................................................................................................... 253 Functions-In TDL.......................................................................................................................... 254 Function-Building Blocks.............................................................................................................. 254 Definition Block............................................................................................................................. 2 55 Procedural Block........................................................................................................................... 257 Valid Statements inside a Function................................................................................................. 258 Programming Constructs In Function............................................................................................... 258 Actions used in a TDL Function....................................................................................................... 267 Calling a Function............................................................................................................................ 278 Using the Action 'CALL'.................................................................................................................. 278 Using the Symbol Prefix '$$'........................................................................................................... 278 Function Execution-Object C ontext.............................................................................................. 279 Target Object Context.................................................................................................................... 279 Parameter Evaluation Context......................................................................................................... 279 Return Value Evaluation................................................................................................................. 279 What's New in Release 5. 5. 2 Language Enhancements in Procedures (TDL).............................................................................. 283 Action-Browse URL..................................................................................................................... 283 Function-Sys Info......................................................................................................................... 283 Attribute-Data Source.................................................................................................................. 283 What's New in Release 5. 4. 9 Definition-Rule Set........................................................................................................................ 287 Attribute-Break On...................................................................................................................... 287 Attribute-Walk On........................................................................................................................ 287 Attribute-Rule............................................................................................................................. 2 88 Attribute-Aggr Rule...................................................................................................................... 289 Attribute-Rule Set........................................................................................................................ 289 Attribute-Name Set...................................................................................................................... 290 Attribute-Name Map.................................................................................................................... 290 Function-Evaluate Rule Set............................................................................................................ 290 Definition-Name Set...................................................................................................................... 292 Attribute-List Name/List................................................................................................................ 293 Function-Name Get Value.............................................................................................................. 293 Data Type-Flag Set....................................................................................................................... 294 Function-Flag Get Value................................................................................................................ 294 Function-Flag Set OR.................................................................................................................... 294 Function-Flag Set AND.................................................................................................................. 295 Function-Flags Is All True............................................................................................................... 295 Function-Flags Is All True From Level................................................................................................ 296 | TDL_Reference_Manual.pdf |
vi i Function-Flags Is Any True............................................................................................................. 296 Function-Flags Is Any True From Level.............................................................................................. 297 Function-Flags Count................................................................................................................... 298 Function-Flags Count From Level.................................................................................................... 298 Function-Flag Get Description........................................................................................................ 299 Function-Flags List Description....................................................................................................... 299 Function-Flags List Description From Level....................................................................................... 300 Function-As Flag Set..................................................................................................................... 301 Data Type-Num Set...................................................................................................................... 301 Function-Num Get Value............................................................................................................... 301 Function-As Num Set.................................................................................................................... 302 Other Enhancements....................................................................................................................... 302 Attribute-MAX............................................................................................................................. 3 02 What's New in Release 5. 4. 8 Language Enhancements in Primitives (TDL)................................................................................. 303 Function-Is Any Empty................................................................................................................... 303 Language Enhancemen ts in Procedural (TDL)............................................................................... 303 Language Enhancements in Quer y (Collections)............................................................................ 303 Conditional Walk Ex........................................................................................................................ 303 Other Enhancements..................................................................................................................... 304 Enhancements in Customisation us ing Productivity Suite............................................................... 304 What's New in Release 5. 3. 8 Action-Format Excel Sheet........................................................................................................... 305 What's New in Release 5. 3 Attribute-Confirm Text/Query Text................................................................................................ 307 Action-Exec Excel Macro.............................................................................................................. 307 What's New in Release 5. 2 Column-wise repeat o f data over a collection.................................................................................. 3 0 9 Function-Tpl Column Object........................................................................................................... 309 What's New in Release 5. 0 Customisation using Producti vity Suites.......................................................................................... 311 Other Language Enhancements...................................................................................................... 322 What's New in Release 4. 8 Data Importing Enhancements........................................................................................................ 329 Events Introduced............................................................................................................................ 336 Action Enhancements...................................................................................................................... 341 Function Enhancements.................................................................................................................. 347 New Objects and Colle ction Attributes to support Banking............................................................. 348 Miscellaneous Enhancements......................................................................................................... 350 | TDL_Reference_Manual.pdf |
vi ii What's New in Release 4. 7 Developer Mode Enhancements ..................................................................................................... 353 Event 'Nat Lang Query' Introd uced................................................................................................... 357 ZIP-UNZIP..................................................................................................................................... 360 Columnar Capability in Edit M ode................................................................................................... 366 New data types Introduced.............................................................................................................. 367 What's New in Release 4. 61 COM Data Types Support............................................................................................................... 389 What's New in Release 4. 6 COM DLL Support in TDL............................................................................................................... 393 Developer Mode.............................................................................................................................. 400 What's New in Release 4. 5 Platform Functions........................................................................................................................... 417 Action Enhancements...................................................................................................................... 422 What's New in Release 3. 62 Multiple Orientation Support for Printing.......................................................................................... 425 What's New in Release 3. 61 Action Enhancements...................................................................................................................... 427 Function Enhancements.................................................................................................................. 428 What's New in Release 3. 6 Collection Enhancements................................................................................................................ 431 Action Enhancements...................................................................................................................... 432 Platform Functions and Variables.................................................................................................... 433 What's New in Release 3. 0 Collection Enhancements................................................................................................................ 439 Image Printing Capabilitie s.............................................................................................................. 444 Enhanced Columnar Capabilit y....................................................................................................... 448 Persisting Variables at System Scope in a User Specified File....................................................... 458 New Events Introduced................................................................................................................... 462 Enhancement-Programmable Co nfiguration................................................................................ 466 Optional Default TDL Loading......................................................................................................... 467 Refresh Issues in context of Use r Defined Function Evaluation...................................................... 468 What's New in Release 2. 0 TDL Procedural Enhancements...................................................................................................... 477 Variable Framework Enhancements............................................................................................... 4 9 9 Event Framework Enhancement s................................................................................................... 513 Action Enhancements...................................................................................................................... 515 | TDL_Reference_Manual.pdf |
ix TDL Enhancements for Remoting................................................................................................... 517 Default TDL Changes...................................................................................................................... 523 What's New in Release 1. 8 Invoking Actions on Event Occurr ence-with System and Printing Events Introduced................... 533 Collection Enhancements................................................................................................................ 536 Evaluating expressions by Changi ng the Object Context with $$Re q Owner Introduced................ 557 Variable Framework with Compound Variables Introduced............................................................ 573 Licensing Binding Mechanism......................................................................................................... 632 What's New in Release 1. 61 Narrowing Table Search.................................................................................................................. 639 What's New in Release 1. 6 General Enhancements................................................................................................................... 641 Collection Enhancements................................................................................................................ 648 User Defined Functions Enhan cements.......................................................................................... 657 New Functions................................................................................................................................. 661 What's New in Release 1. 52 Collection Enhancement s-Attribute 'Data Source' enhanced........................................................ 665 Enhancements in User Defined Functions...................................................................................... 6 66 New Functions................................................................................................................................. 670 https URL support in Tally............................................................................................................... 671 What's New in Release 1. 5 Collection Enhancements................................................................................................................ 673 List Variables Introduced................................................................................................................. 676 Dynamic Actions.............................................................................................................................. 683 New Functions................................................................................................................................. 684 New Attribute-Trigger Ex.............................................................................................................. 687 New Actions..................................................................................................................................... 688 Tally Command Line Paramete rs.................................................................................................... 689 Appendix | TDL_Reference_Manual.pdf |
Section I TDL-The Development Language of Tally. ERP 9 | TDL_Reference_Manual.pdf |
TDL_Reference_Manual.pdf |
|
3 T ally Definition Language-An Introduction Introduction T ally Solutions has been in the business of providing complete business solutions for over 20 years to MSME (Micro, Small and Medium Enterprise) and to a lar ge extent to LE (Large Enterprise) businesses. With o ver 3 million users in over 1 00 countries, T ally, the flagship product, continues to be the preferred IT solution for a majority of bus inesses every year. T ally, the flagship product (which started as a simple bookkeep ing system, 20 years ago), is today a comprehensive, integrated solution-covering several b usiness aspects of an enterprise. These include Accounting, Finance Management, Receivables/Payables, Inventory Accounting, Inventory Management, Bo M-based manufacturing inventory, multi-location/multi-currency/multi-unit handling, Budgets and Controls, Cost and Profit Centres, J ob Costing, POS, Group Company consolidations, Statutory T axes (Excise, V A T, CST, TDS, TCS, FBT, etc), Payroll Accounting, and other major and minor capabilities. It has served as an ERP for small enterprises over the past 12 years. With the introduction of Remote Access, Remote Authentication, Support Centre, Central Administration and Account Management inherently supported in t he product, it can be formally labelled as T ally. ERP 9. With this capability, it is possible that the owner or an authorized user will be able to access all the reports and information from a remote locatio n. With each forthcoming release subsequent to T ally. ERP 9 Release 3, additional capabilities wi ll be delivered to cater to large business enterprises. The major functional areas in T ally are: Order to Payment (Purchase Processes)Simple (Cash Purchase) to Advanced Purchase Processes-including Ordering, Receipting, Rejections, Discounts, etc. Order to Receipt (Sales Processes)Simple (Cash Sales) to Advanced Sales Processes-including Orders Received, Delivery, Invoicing, Rejections and Receipting, POS Invoicing at Retail. Material to Material (Manufacturing Processes)Simple to Multi-step material transformations, Discrete and Pro cess Industry cycles, Work in progress and valuations. Payroll Simple to Complex Payrolls-including working with different U nits of Measures (e. g., Job rates), Statutory compliances, their specifications and usage. MIS A complete set of reports for Business requirements are as foll ows: Financial, Inventory, MIS & Analysis, Budgeting & Controls with advanced classificat ion and filtering techniques, Group companies and multiple consolidatio n views, Cross-Period Reporting, | TDL_Reference_Manual.pdf |
TDL-Introduction 4 Forex handling, Bank Reconciliation, etc. There is also an 'Exp ort' option to port data into other applications (e. g., Spreadsheets) for additional manipulation. Statutory Compliance The Compliance Requirements and related configurations in T ally. ERP 9 are as follows, with regard to the implementation of: Direct T axes: TDS/TCS, FBT Indirect T axes: Excise, Service T ax, V A T, CST Enabling Environment for Remote-Tally. NET Users T ally Software Services (TSS) is responsible for the Remote Acc ess Services. It allows: Remote Access-It is now possible for an authenticated user to access T ally. E RP 9 from any computer system. T ax Audit T ools-The CA community will now be able to deliver affordable servic es to client, addressing their Security and Privacy concerns. 1. T ally Definition Language T ally Definition Language is the application development langua ge of T ally. T D L h a s b e e n developed to provide the user with the flexibility and power to extend the default capabilities of T ally, and integrate them with the external applications. TDL provide s a development platform for the user. The entire User Interface of T ally. ERP 9 is built using TDL. T DL as a language, provides capabilities for Rapid Development, Rendering, Data Management and Integration. TDL is an Action-driven language based on definitions. It empha sizes strongly on the concept of re-usability. It comprises of Interface and Data objects. Interface Objects mainly determine the behaviour of the product in t erms of user experience. Data objects are mainly used for data persistence in the T ally Database. Any T ally. ERP 9 user can learn TDL and develop extensions for T ally. The entire source code is available as a part of the T ally Development Environment, i. e., with our product T ally Developer. 1. 1 Comparison with other Languages T oday, there are many languages in the world which are used to develo p applications. These languages are developed keeping some specific areas of applicat ion in mind. Some languages are good for developing front-end applications, while others ma y be good for writing system programs. The various categories of languages available today ar e as follows: Low Level Languages Low level Languages are languages that can interact directly wi th the hardware. They comprise instructions which are either directly given in computer-unders tandable digital code or in a pseudo code. These languages require very sound knowledge in hardware. For example, Assembly language or any native machine language. | TDL_Reference_Manual.pdf |
5 TDL- Introduction Middle Level Languages Middle Level Languages consist of syntax, rules and features ju st like the high level languages. However, they can also implement low level languages as part of the cod e. For example, C, C++, etc. High Level Languages High level languages are very much like the English language. T hey are easy to learn, program and debug. High level programming languages are sometimes divided into tw o categories: Third Generation and Fourth Generation languages. Third Generation Languages Most High Level languages fall in the category of Third Generat ion Languages. Third Generation languages are procedural languages, i. e., the programmer specif ies the sequence of execution and the computer strictly follows it. The execution starts from the first line of the code to the last line, taking care of all the control statements and loops used in the program. Fourth Generation Languages There is no clear-cut definition for the Fourth Generation Lang uages (4GL). Normally, the 4GL are high level languages which require significantly fewer instruct ions to accomplish a task. Thus a programmer is able to quickly develop and deploy the code. Most 4GL are non-procedural languages. E. g., Some 4GL are used to retrieve, store and modify data in t he database using a single line instruction, whereas other 4GL use report generators to generate complex re ports. It is sufficient to specify headings and totals using the language, and the repo rt is generated automatically. Certain 4GL can be used to specify the screen design, which wil l automatically be created. On having understood the categorization of computer languages, TDL can be categorised as a Fourth Generation, High Level Language. The capabilities which TDL provides to the users is much more than what other 4GL languages provide. This may extend to meeting specific purposes like database management, report generation, screen de sign, etc. TDL is a comprehensive 4G language which gives tremendous power in the hands of the programmer by providing data management, complex report generat ion and screen design capabilities, using only a few lines of code, leading to rapid development. Let us now analyse the features in detail, which help us in understanding and appreciating the capabilities provided by the development language of T ally, i. e., 'TDL-T ally Definition Language'. | TDL_Reference_Manual.pdf |
TDL-Introduction 6 2. The TDL Program-At a Glance Before we discuss the capabilities and features of TDL in detai l, let us have a look at the basic TDL program. The following figure describes all the components in a TDL Prog ram. The description, usage and detailed explanation of each compone nt will be taken up in the subsequent chapters. Figure 1. 1 TDL Components | TDL_Reference_Manual.pdf |
7 TDL- Introduction 3. TDL Capabilities Rapid Development TDL is a language based on defini tions. It is possible to reuse the existing definitions and deploy them. This is a language meant for rapid development. It is pos sible to develop complex reports within minutes. The user can extend the default functionalities of the product by writing a code consisting of a few lines. Multiple Output Capability The same language can be used to send the output to multiple ou tput devices and formats. Whenever an output is generated, it can be displayed on the scr een, printed, transferred to a file in particular format, and finally mailed or transferred to a we b-page using Http protocol. All this is made possible just by writing a single line of code. Just imagi ne the technology used to develop the platform that such a complex task is developed and implemen ted using only a few lines. Data Management Capability As discussed earlier, the data is stored and retrieved as objects. There are a few internal objects predefined by the platform. Usi ng TDL, it is possible to create and manipulate information on these with ease. Suppose, an additional field is required by th e user to store information as a part of the predefined object. This capability is also provided in T DL, i. e., by using TDL, the user can create a new field and store a value into it, which can be pers isted in the T ally. ERP 9 database. Integration Capability T o meet the challenges of the business environment, it becomes absolutely mandatory to share information seamlessly across ap plications. Integration becomes a crucial factor in avoiding the duplication of data entry. The T ally. ERP 9 platform has a built-in capability of integrat ing data with other applications. The following are the different types of int egrations possible in T ally. ERP 9: T ally. ERP 9 to T ally. ERP 9 using Sync T ally. ERP 9 to external applications in various data formats External DB to T ally. ERP 9 using XML and SDF formats T ally. ERP 9 DB to external applications using ODBC External DB to T ally. ERP 9 using ODBC 4. TDL Features Definition Language A definition language provides the users with 'Definitions' tha t can be used to specify the task to be performed. The user can specify the task to be performed, bu t has no control over the sequence of events that occur while performing the specified ta sk. The sequence of events is implicit to the language and cannot be changed by the user. TDL works on Named Definitions, which means that every definition should have a name and that n ame should be unique. TDL has User Interface Objects like Reports, Forms, Parts, Lines and Fi elds as definitions. TDL can define Reports, Menus, Forms, and so on, but the Definitions will not have any relevance unless they are used. Definitions are deployed by use, not by e xistence. | TDL_Reference_Manual.pdf |
TDL-Introduction 8 TDL is based on concepts pertaini ng to Object Oriented Programm ing. This language has been created for reusability. Once a definition is created, it can be reused any number of t imes. Besides the reusing capability, the user can also add new features, along with the existing de finitions. T ally. ERP 9 has a singular view of all the TDL Definitions, whi ch means that the T ally. ERP 9 executable reads TDL (user defined and default) as one program. On invoking T ally. ERP 9, all the default TDL files of TDLServer. DLL will be loaded. The user TDL s will be subsequently loaded as specified in T ally. ini. Non-Procedural Language Most of our programming experience has been in dealing with a p rocedural language where we define a sequence of actions to define the sequence of events t hat take place. The entire control is with the programmer. The programmer is able to determine the start and end-point of t h e program. The programmer cannot control the sequence. All the sequences are implicit in the program. The programmer cannot write his/her own procedure. The platform provides a set of functions for the TDL programmer. Action-Driven Language The programmer can only control as to what happens when a parti cular event takes place. During interaction, the user can select any sequence of actions. Based on his/her action, a particular segment of code gets executed. Rich Language TDL is a rich language, that refers to a list of functions, att ributes, actions, etc., which are provided by the platform. It is possible to develop a complex r eport or modify the existing one within no time. Imagine how many lines of code would be require d if a simple button were to be added using a traditional programming language. Flexibility and Speed The architecture of the software and the language provide extra ordinary flexibility and speed. Speed in this regard refers to the speed of deployment. With T ally. ERP 9, the deployment is extremely rapid. T ally. ERP 9 is flexible enough to change its functionality base d on the customer's business requirements. Most of the times, the customer-specific requirem ents may seem like major functional changes that have to be done, but they may only be minor variations of the existing functionality, which can be done within no time. Learning Outcome The major functional areas of T ally. ERP 9 are purchase processe s, sales processes, manufacturing processes, payroll, MIS, statutory compliance and TSS. TDL is the application development environment of T ally. ERP 9. TDL is a Fourth Generation High Level Language. TDL is not only a definition language, but also a non-procedura l, action-driven language. | TDL_Reference_Manual.pdf |
9 TDL Components Introduction TDL is a language based on definitions. It is an action-driven language, i. e., 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. 1. 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 lang uage background to work on TDL. The TDL statements required to perform a particular task, can b e created in a file using IDE provided by T ally. ERP 9, such as T ally Developer. Such a file is called a TDL file. 1. 1 Steps to create a TDL Program Open any ASCII text editor such as notepad, or use the IDE T all y Developer, provided by T ally. ERP 9. Create a new file. Type TDL statements in the file. Save the file with a meaningful name and extension, as applicab le 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 (T ally Compliant Product). It is possible to compile the file for a particular T ally serial numb er. It is possible to run all files, i. e.,. txt,. tdl and. tcp in T all y. ERP 9. 1. 2 Specification of TDL Files There are two ways of implementing the TDL code: Specifying the TDL files in T ally. ini (Configuration Settings F ile) Specifying the TDL files through T ally. ERP 9 application config uration screen Specifying the TDL files in T ally. ini The path of the TDL program has to be included in the T ally. ini file, using a parameter called 'TDL'. If the parameter 'User TDL' is set to NO, T ally. ERP 9 will not read any TDL parameters specified in the T ally. ini file. Syntax User TDL = Yes TDL = <Path\filename> with extension Example : User TDL = Yes | TDL_Reference_Manual.pdf |
TDL Components 10 TDL = C:\Tally. ERP 9\My Report. tcp or TDL = C:\Tally. ERP 9\My Report. txt When T ally. ERP 9 starts, it looks for a file named 'My Report. tc p' or 'My Report. txt' in the directory C:\T ally. ERP 9. On loading the default TDL files into memory, T ally. ERP 9 reads and loads every TDL file mentioned in T ally. ini into memory before displaying t he first Menu, 'Gateway of T ally'. Specifying TDL file through T ally. ERP 9 application configurati on screen Alternatively, the TDL file name can be specified in TDL Configuration screen, by going to F12: Configuration-> 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 th e Path\filename, with extension, in 'List of TDLs to preload on T ally Startup'. Following figure sh ows the TDL configuration screen: Figure 2. 1 Specification of TDL files T o load a Default Company in T ally. ERP 9, the 'Load' parameter is used as follows: Example : Default Companies = yes Load = 00002 | TDL_Reference_Manual.pdf |
TDL Components 11 Here, 00002 is the company folder that resides in T ally. ERP 9\Data. The data path can be specified with the parameter 'Data'. Example : Data = C:\Tally. ERP 9\Data 1. 3 Executing Multiple Files using Include Definition Since TDL can span or exist across files, the definition 'INCLU DE' provides the convenience of modularizing 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 includ e another TDL file into a file, instead of declaring it in T ally. 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. t xt. T o run both the files, we have to include sample2. txt in sample1. txt. [Include : sample2. txt] 2. TDL Interfaces We have already seen that TDL is a language based on definition s. When we start T ally. ERP 9, the Interfaces which are visible on the screen are Menu, Report, Button and T able. 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 t he 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 invo ked 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 F orm, 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 Restart T ally. ERP 9 whenever there are changes made in the TDL program, so that they can be implemented. | TDL_Reference_Manual.pdf |
TDL Components 12 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. 3. 'Hello TDL' Program The 'Hello TDL' program demonstrates the basic structure of TDL. The Report is executed from the existing Menu 'Gateway of T ally'. Purpose: T o invoke a new Report displaying the text “Welcome to the world of TDL” from the main Menu 'Gateway Of T ally': [#Menu : Gateway of Tally] Item : First TDL : Display : First TDL Report [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 'Fi rst TDL' in the 'Gateway Of T ally' 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 'F irst TDL '. User input s 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_Reference_Manual.pdf |
TDL Components 13 Figure 2. 2 Output of W elcome to the world of TDL program 4. TDL Components The TDL consists of Definitions, Attributes, Modifiers, Data Ty pes, Operators, Symbols and Prefixes, and Functions. Let us now analyse the components of t he language. 4. 1 Definitions T ally 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 par t of other definitions. Whenever a change in code needs to be reflected in a program, T ally. 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 ins tantiate the definition, i. e., whenever a definition is created, a new objec t of a particular definition type comes into existence. | TDL_Reference_Manual.pdf |
TDL Components 14 Example: [Part : Part One] In this example, the type of definition is Part and the name of the definition is Part One. T ypes of Definitions The various definitions in TDL are categorized as follows: Interface Definitions-Menu, Report, Form, Part, Line, Fields, Button, T able Data Definitions-Object, V ariable, 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 refer red to as Interface definitions. The definitions in this category are Menu, Report, Form, Part, Line, Field, Button and T able. Menu: A Menu displays a list of options. The T ally. ERP 9 application determines the action to be performed on the basis of the Menu Item selected by the user. The 'Gateway of T ally' 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 T ally. ERP 9, i. e., any input screen or output screen, is created using the 'Repor t' 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 select ing a menu item, by pressing a key or by clicking on a button. The 'Button' definition allow s the user to display a button on the Button bar and execute an action, when it is clicked. T able : The 'T able' definition displays a list of values as a T able. Data from any collection can be displayed as a T able. Data Definitions Definitions which are used for storing the data are referred to as Data Definitions. The definitions in this category are Object, V ariable 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 Interna l (platform defined). External or user-defined objects are not persistent in the T ally database. It is not possible to create an Internal Object Definition in TDL, i. e., they are predefined by the platform. It is, though, possibl e to perform modifications on it. A Ledger/Group is an example of an internal object. | TDL_Reference_Manual.pdf |
TDL Components 15 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 o f objects. Variables: V ariables 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 r eferred to as Formatting Definitions. The definitions in this category are Border, Style and Color. Border: This introduces a single/double line as per user specification s. Thin Box, Thin Line and Common Border are all examples of pre-defined borders. Style: The 'Style' definition determines the appearance of the text t o be displayed by using a font scheme. The Font name, Font style and Font size can be changed/ defined using the 'Style' defini tion. In default TDL, the pre-defined Style definitions are Nor mal 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 expre ssed as an attribute. In TDL, the only color names that can be specified are Crystal Blu e and Canary Y ellow. Integration Definitions Definitions which make the import of data available in SDF (Sta ndard Data Format) are referred to as Integration Definitions. 'Import Object' and 'Import File' a re the two definitions classified in this category. Import Object: This identifies the type of information that is being imported into T ally. ERP 9. The importable objects can be of the type Groups, Ledgers, Cost cen tre, Stock Items, Stock Groups, Vouchers, etc. Import File: The 'Import file' definition allows the user to describe the st ructure of each record in the ASCII file that is being imported. The field width is speci fied as an attribute of this definition. Action Definitions The action definitions allow the user to define an action, to t ake 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 ke y combination. The action is performed when the associated key combination is pressed. System Definitions System Definitions are viewed as being created by the administr ator profile. Any items defined under System Definitions are available globally across the appl ication. System Definitions can be defined any number of times in TDL. T he items defined are appended to the existing list. System Definitions cannot be modified. | TDL_Reference_Manual.pdf |
TDL Components 16 Examples of System Definitions are System: Variable, System: Formula, System: UDF and System: TDL Names. 4. 2 Attributes Each definition has properties, referred to as 'Attributes'. Th ere is a predefined set of attributes provided by the platform for each definition type. The attribute specifies the behaviour of a defini tion. Attributes differ from Definition to Definition. A Definition can have multiple attributes associated with it. Each attribute has a 'Name' (predefined) an d 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 a re 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 : Part One] Line : Part One 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 o n 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 mu ltiple 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 multip le times. This attribute also accepts a comma-separated list. | TDL_Reference_Manual.pdf |
TDL Components 17 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 multi ple times. The attribute 'Repeat' is an example of 'Dual' type. Example : Repeat : Line 1 : Collection 1 Dual List type attributes accept two values, and can be specified multipl e times. Example : Set : Var 1 : “Hello” Set : Var 2 : “TDL” The values “Hello” and “TDL” are being assigned to the variable s V ar 1 and V ar 2, respectively. Triple and Triple List Triple type attributes accept three values, and can't be specified mul tiple times. Example : Object : Ledger Entries : First: $Ledger Name = “Tally” Triple List type attributes accept three values, and can be specified multi ple times. Example : Aggr Compute : Tr Purc Qty: Sum : $Billed Qty Aggr Compute: Tr Sale Qty : Sum : $Billed Qty The Attribute type 'Menu item' The attribute type 'Menu Item' allows the user to add a menu it em 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 T ally' Menu. For the option 'Purchase An alysis', the character 'P' is explicitly specified as a hot key. | TDL_Reference_Manual.pdf |
TDL Components 18 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 form s 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 For m. If one chooses a Report that has no Forms defined, T ally. ERP 9 assumes that the Form Name is the same as the Report Name and looks for it. If it exists, T al ly. ERP 9 displays it. Otherwise, T ally. 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, T ally. ERP 9 displays the name of the Report as Titl e, when it is invoked from the menu. If the 'Title' attribute is specified, then it overrides the defau lt title. Example: [Report : HWReport] Form : HWForm Title : “Hello World” Here, “Hello World” is displayed as the title of the Report, in stead 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 Par ts are aligned vertically. Syntax Part/Parts : <List of Part Names> | TDL_Reference_Manual.pdf |
TDL Components 19 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 This attribute is typically used to set text for prompts and ti tles 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. | TDL_Reference_Manual.pdf |
TDL Components 20 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. Skip This attribute causes the cursor to skip the particular field a nd 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 Wo rld' and forces the cursor to skip the field. It can also be rewritten as: [Field : HW Field] Type : String Info : “Hello World“ 4. 3 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, bas ed 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 t he mode of evaluation: Static/Load time modifiers: Use, Add, Delete, Replace/Change Dynamic/Real time modifier s: Option, Switch and Local The attribute Info at Field combines both Skip and Set As. | TDL_Reference_Manual.pdf |
TDL Components 21 Static/Load time Modifiers These modifiers do not require any condition at the run time. T he 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 De finition. Syntax Use : <Definition Name> Example : [Field : DSPExplode Prompt] Use : Medium Prompt All the properties of the existing field definition Medium Prompt are applicable to the field DSPExplode Prompt. 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 definit ion 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 : Change Item A new button Change Item is added to the form Cost Centre Summary. Example : [#Part : VCH Narration] Add : Line : Before : VCH Narr Prompt : VCH Cheque Name, VCH Ac Payee The lines 'VCH Cheque Name' and 'VCH Ac Payee' are added before t he line 'VCH Narr Prompt' in the part 'VCH Narration'. | TDL_Reference_Manual.pdf |
TDL Components 22 Delete The 'Delete' modifier is used in a definition to delete an attr ibute 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 : Change Item The button 'Change Item' is deleted from the form 'Cost Centre S ummary'. The functionality of the button 'Change Item' is no longer available in the form 'Cost Ce ntre 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 attr ibute 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 defini tion 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 t he 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 cond ition. These modifiers are run every time the TDL is executed in an instance of T ally. 'Option', 'Switch' and 'Local' are the Dynamic modifiers. | TDL_Reference_Manual.pdf |
TDL Components 23 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 : <Definition Name> : <Old Attribute Value> : <New Attribute Value> Example : Local : Field : Name Field : Set As : #Stock Item Name V alue of the formula #Stock Item Name is now the new value for the attribute Set As of the field Name Field applicable only for this instanc e. 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', 'For m', '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 usi ng the definition modifier !. If the 'Logical' value is set to TRUE, then the Optional defini tion becomes a part of the original definition, and the attributes of the original definition are m odified based on this definition. Example : [Field : Fld Main] Option : Fld First : cond1 Option : Fld Second : cond2 The field Fld First is activated when cond1 is true. The field Fld Second is activated when cond2 is true. Optional definitions are created with the symbol prefix " !" as follows: [!Field : Fld First] [!Field : Fld Second] 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 condition s for all the options provided in the description code, and applies only those which satisfy the eval uation conditions. | TDL_Reference_Manual.pdf |
TDL Components 24 The attribute 'Switch' can be used in scenarios where evaluatio n is carried out only till the first condition is satisfied. Apart from this, 'Switch' statements can be grouped using a lab el. 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 : ##Sample Switch1 Switch : Case1 : Sample Switch2 : ##Sample Switch2 Switch : Case1 : Sample Switch3 : ##Sample Switch3 Switch : Case2 : Sample Switch4 : ##Sample Switch4 Sequence of Evaluation-Attributes The order of evaluation of the attributes is as specified below : 1. Use 2. Normal Attributes3. Add/Delete/Replace 4. Option 5. Switch6. Local Delayed Attributes Add/Delete/Replace are referred to as Delayed attributes becaus e even if they are specified within the definition in the beginning, their evaluation will b e delayed till the end, within the static modifier and normal attributes. 4. 4 Actions in TDL TDL is an action-driven language. Actions are activators of spe cific functions with a definite result. Actions are performed on two principal definition types, 'Repor t' and 'Menu'. An action is always associated with an originator, requestor and an object. All the actions originate from the Me nu, Key and Button. An action is evaluated in the context of the Requestor and Obje ct. Typically, actions are initiated through the selection of a Menu item or through an assignment t o a Key or a Button. Examples of Actions are: Display, Menu, Print, Create, Alter, etc. Syntax Action : <Action Name> [: <Definition/Variable Name> : Formula] | TDL_Reference_Manual.pdf |
TDL Components 25 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 perf ormed. Example : Action : Create : My Sample Report 4. 5 Data T ypes The Data Types in TDL specify the type of data stored in the fi eld. 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 T ype This holds only one type of data. These data types cannot be fu rther divided into sub-types. String, Number, Date and Logical data types fall in this category. Compound Data T ype 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 T DL are: Amount, Quantity, Rate, Rate of exchange and Aggregate. Table 2. 1 Data Types and its Sub-Data Types Data Types Sub-Types Simple Data T ypes Number String Date Logical Compound Data T ypes Amount Base/Direct Base Forex Rate Of Exchange Dr Cr Quantity Number Primary Units/Base Units Secondary Unit/Alternate Units/T ail Units Rate Price Unit Symbol Rate of Exchange Rate Price | TDL_Reference_Manual.pdf |
TDL Components 26 The type for the field definition is specified using the Ty p e attribute. Syntax [Field : <Field Name>] Type : <Data type> : <Sub-type> Example : [Field : Qty Secondary Field] Type : Quantity : Secondary Units 4. 6 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 Table 2. 2 Arithmetic Operators Logical Operators The logical operators used are: OR, AND,NOT, TRUE/ON/YES and FALSE/OFF/NO Table 2. 3 Logical Operators Comparison Operators+ Addition ‐ Subtraction / Division * Multiplication 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. | TDL_Reference_Manual.pdf |
TDL Components 27 A Comparison Operator compares its operands and returns a logic al value based on whether the comparison is True. The Comparison Operator returns the value a s TRUE or FALSE. T D L supports the following Comparison Operators: Table 2. 4 Comparison Operators String Operators String operators facilitate the comparison of two strings. The following are the String operators: Table 2. 5 String Operators 4. 7 Special Symbols The Symbol Prefix in T ally Definition Language (TDL) has differ ent usage and behaviour, when used with different definitions and attributes of definitions. Special Symbols used in TDL are $, $$, @, @@, #, ##, ;, ;;, ;;;, /* */, +, !, * a n d _ . Each of these symbols are used for a specific purpose. The usage of eac h of these symbols will be discussed in detail in the subsequent chapters. = /Equal/Equals Checks if the values of both the expressions are equal. </Less Than/Lesser Than / Lesser Checks if the value of <expression 1> is less than the value of <expression 2>. >/Greater Than/More Checks if the value of <expression 1> is greater than the value of <expression 2>. In Checks if the value is in the List of comma separated values. Null Checks whether the expression is Empty. Between.... And Checks if the expression value is in the range. 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. The operator '=' is a comparison operator, not an assignment operator. There is no assignment operator in TDL. While evaluating the expression, some keywords are ignored. The keywords which are not considered are Than, With, By, To, Is, Does, Of. | TDL_Reference_Manual.pdf |
TDL Components 28 4. 8 Functions A function is a small code which accepts a certain number of pa rameters, performs a task and returns the result. The function may accept zero or more argume nts, 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 cat er to the business requirement of the T ally. 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 $$String Length, $$Date, $$Round Up, $$As Amount. TDL directly supports a variety of business related functions such as $$Get Price From Level, $$Bill E xists, $$Forex V alue, etc. Syntax $$<Function Name> : <Argument List> Example : $$Sys Name : End Of List Here, the function $$Sys Name returns TRUE, if the parameter pas sed 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: Report uses a Form Form uses a Part Part uses a Line Line uses a Field and 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, Attr ibutes, Modifiers, Data Types, Operators, Symbols & Prefixes, and Functions. | TDL_Reference_Manual.pdf |
29 Symbols and Prefixes Introduction In the previous lesson, we discussed the various TDL Components like definitions, attributes, functions, symbol prefixes, variables, etc. In TDL, there are a few symbols which are used for specific pur poses. Some symbols are used as access specifiers, i. e., mainly used to access the value of a m ethod, variable, field, formula, etc. Some are used for general purpose, such as modifiers. Figure 3. 1 Symbol Categorization 1. Access Specifiers/Symbol Prefixes Table 3. 1 Access Specifiers Symbols Usage @ Used to access Local formula @@ Used to get the value of a System formula # When prefixed to Field name, gives the value of the field ## Used to get the value of a Global variable $ Used to access the value of an Object Method $$ Used to call a Function | TDL_Reference_Manual.pdf |
Symbols and Prefixes 30 2. General Symbols Table 3. 2 General Symbols 3. The Usage of @ and @@ Formula In TDL, large complex calculations can be broken down into smal ler simple calculations or expressions expressed as a Formula. The values computed using t hese formulae can be accessed using the symbol prefixes @ and @@. Naming Conventions for Formula Case insensitive Only alphanumeric characters are allowed Space insensitive at Definition time. However, during deployment or usage of the same, spaces are not allowed Classifications of formulae Local Formula Global Formula 3. 1 Defining a Local Formula using @ A Local Formula is one which can be defined and retrieved at an y Interface Definition. The scope of the local formula is only within the current definition. A l ocal formula is usually defined if the formula is specific to a definition and not required by any oth er definition. The value of a Local Formula can be accessed by using the Symbo l Prefix @. Example : [Field : Company Nameand Address] Set as : “Tally India Pvt Ltd, No 23 & 24, AMR Tech Park II, Hongasandra,+ Bangalore” This code can also be written, using the Local Formula, as: [Field : Company Nameand Address] Symbols Usage ; ;; ;;; /* */ Used for adding comments in TDL + Used as line continuation character _ (underscore) Used to expose methods to ODBC SQL Procedure * Used to Reinitialize a Definition ! Used to create an Optional Definition # Used as a definition modifier Symbols Usage | TDL_Reference_Manual.pdf |
Symbols and Prefixes 31 Company : “Tally India Pvt Ltd, ” Address : “No 23 & 24, AMR Tech Park II, Hongasandra, ” City : “Bangalore” Set as : @Company + @Address + @City 3. 2 Defining a Global Formula using @@ A Global Formula is one which, when defined once, is available globally. In other words, the Global Formula value can be accessed by all the Definitions. A Global formula is defined when a formula is required at many locations. The value of a Global Fo rmula can be accessed using the Symbol Prefix @@. A Global Formula can also be referred to as a System Formula. All the Global Formulae must be defined within the [System: Formula] Definition. Example : [System : Formula] Amt Width : 20 [Field : Rep Title Amt] Width : @@Amt Width [Field : Rep Detail Amt] Width : @@Amt Width [Field : Rep Total Amt] Width : @@Amt Width In this example, all the Fields assume the same width. If the w idth of the fields needs to be altered, a change is made only at the [System: Formula] Definition Section. This change will be applied to all the Fields, using the Global Formula Amt Width. 4. The Usage of # and ## In TDL, the Symbol Prefix # can be used for: Referencing a field using # Modifying the existing definitions using # | TDL_Reference_Manual.pdf |
Symbols and Prefixes 32 4. 1 Referencing a Field using # The Symbol Prefix # is used to r etrieve the value from another Field. Example : [Field : HW] Set as : “Hello World” [Field : HW1] Set as : #HW In this example, the value within the Field 'HW' is being set t o the Field 'HW1'. In other words, the Field HW1 is set to “Hello World”, by using #HW. 4. 2 Modifying existing Definitions using # The Symbol Prefix # is also used to modify existing definitions. One can alter the attributes of the definition. For example, adding a new Field within a 'Line' def inition. Example : [#Menu : Gateway of Tally] Add : Key Item : Hello World: H : Display : HWReport Title : “Tally Gateway” [#Field : Led Particulars] Width : 50 In this example, the existing Menu 'Gateway of T ally' (default Menu) has been altered to add the Item 'Hello World' and the Title of the Menu has been changed t o 'T ally Gateway'. The existing Field 'Led Particulars' has also been altered to set its attribu te 'Width' to the value of 50. 4. 3 Accessing value from a Variable using ## As the name suggests, a V ariable is a named container of data w hich can be altered as and when required. In TDL, V ariables can be classified as Local and Global V ariables. Loc al variables retain their value only within a particular Report. Global variables, on the other hand, retain their values throughout the session or permanently, based on the 'V ariable' Definition. We will learn more about V ariables later. The value of a V ariable can be ac cessed using the symbol prefix ##. Both Local and Global V ariables can be retrieved using ##. Local variable is being checked for first. In cases where the Local V ariable is not found, the Global V ariable value is assum ed. | TDL_Reference_Manual.pdf |
Symbols and Prefixes 33 Example : [Field : FGField] Set as : ##RTitle [Report : DBLed Report] Title : if ##Ledger Name = “ ” then “Daybook” else “Ledger Report”\ 5. The Usage of $ and $$ 5. 1 Accessing a Method using $ Any information from an Object can be extracted by using a Meth od or UDF. The $ Prefix is used to invoke or deploy the value from a Method or UDF of any Objec t, where the terms 'Method' and 'Object' are TDL-specific. This will be covered in greater dept h in the sections to follow. Context Fall Through for $ Check if it is an Internal method or UDF within the current obj ect User Defined Method System Formula Change the context to parent object and repeat the above steps Example : [Field : My Field] Set as : $Name This code snippet displays the value of the method 'Name' of th e associated object. 5. 2 Calling an Intern al Function using $$ In TDL, functions are inbuilt and TDL Programmers can make use of the same. A function can accept zero or more arguments to perform a specific task on the arguments and return a value. While passing arguments to functions, spaces and special charac ters, except bracket (), are not allowed. If the function parameter requires an expression, it c an be enclosed within bracket (), so as to return the result of the expression as a parameter to the Function. Example : [Field : Current Date] Set as: $$Machine Date [Field : Credit Amt] Set as : if $$Is Dr:$Closing Balance then 0 else $Closing Balance [Field : String Part Field] Set as : $$String Part($Email:Company:##SVCurrent Company):0:5 | TDL_Reference_Manual.pdf |
Symbols and Prefixes 34 6. Commenting a Code using ;, ;; and /**/ Commenting increases readability. In TDL, Comments can be given using symbol prefixes viz. ;, ;; and /* */. Symbol Prefix ; is used for Part line commenting, ;; is used for Single Line Commenting and /* */ is used for Multi Line Commenting. All the lines encl osed within /* and */ will be ignored by the TDL Interpreter as a comment. A Single Semi-Colon (;) is allowed as a comment for single line commenting, but as a standard coding practice, it is recommended to use Double Semi-Colon (;;). Example : /* This code explains the usage of Multi-Line Commenting as well as Single Line Commenting. */ ;; Altering Menu 'Gateway of T ally' [#Menu : Gateway of Tally] Add : Key Item : Comment : C : Display: Comment ;; Menu Item alteration ends here 7. Line Continuation Character (+) A Line Continuation Character (+) is used to split a lengthy li ne into a number of shorter lines. By doing this, the programmer can see the entire line without scro lling to the left or right. This can also help in understanding and debugging the code faster. Example : /* This code explains the mechanism of breaking a line into Multiple Lines using + */ ;; Altering Menu 'Gateway of T ally'[#Menu: Gateway of Tally] Add : Key Item : Before : @@loc Quit : + Line Ctn : C : Display : Line Ctn : + NOT $$Is Empty : $$Selected Cmps 8. Exposing Methods and Creating Procedures (_) The Symbol Prefix (_) is used to expose Methods to ODBC. By pre fixing _ to a Collection Name, it turns into a procedure which can be referenced externally by pa ssing the parameter as a V ariable. Example : ;; Exposing Methods within the Objects to ODBC | TDL_Reference_Manual.pdf |
Symbols and Prefixes 35 [#Object : Ledger] _Difference : $Closing Balance-$Opening Balance ;; Creating Procedures to be referenced externally [Collection : _Led Bills] Type : Bills Child of : #UName SQLParms : UName SQLValues : Bill No: $Name SQLValues : Bill Date : $$String:$Bill Date:Universal Date 9. Reinitialize Definitions (*) This is similar to operators such as '#' (Modify) and '!' (Opti on). When '*' is used for an existing definition, all the attributes of the definition are overridden. This is very useful when there is a need to completely replace the existing definition content with a new code. Example : [*Field : My Field] Width : 20% Page Set as : “This Field has been reinitialized” 10. Optional Definitions (!) The Symbol Prefix ! is used to define optional definit ions. 'Switch' and 'Option' a re attributes which can be used by various definitions like Menu, Form, Part, Line, Field, Collection, Button, Key, Import File and Import Object to provide a conditional result in TDL. However, they cannot be used with Report, Color, Style, V ariable, System Formula, Syste m V ariable, System UDF, Border and Object definitions. The attributes of the original definition are overridden by the attributes of the optional definition only if the Logical Condition is satisfied. In other words, if the Logical Condition returns TRUE, the attributes of the optional definition become a part of the orig inal definition, else they are ignored, leaving the original definition intact. Syntax Option : <Optional Definition> : <Logical Condition> Switch : Label : <Optional Definition> : <Logical Condition> The difference between Switch and Option is that 'Switch' state ments bearing the same label are executed till a satisfying condition is found. On the contrary, 'Option' executes all the Option statements matching the gi ven conditions sequentially. Switch statements bearing different labels are similar to Option statements, as all Switch statements will be executed for the given condit ions. | TDL_Reference_Manual.pdf |
Symbols and Prefixes 36 Example-Option [Line : MFTBDetails] Fields : MFTBName Right Fields : MFTBDr Amt, MFTBCr Amt Option : MFTBDtls Clsg G1000 : $Closing Balance > 1000 Option : MFTBDtls Clsg L1000 : $Closing Balance < 1000 [!Line : MFTBDtls Clsg G1000] Local : Field : MFTBDr Amt : Style : Normal Bold Local : Field : MFTBCr Amt : Style : Normal Bold [!Line : MFTBDtls Clsg L1000] Local : Field : MFTBDr Amt : Style : Normal Local : Field : MFTBCr Amt : Style : Normal In this code snippet, the condition specified in both the optio ns will be checked, and the option satisfying the given condition will be executed. In this case, there is a possibility that more than one condition might be satisfied and get executed. Example-Switch [Line : MFTBDetails] Fields : MFTBName Right Fields : MFTBDr Amt, MFTBCr Amt Switch : Case 1 : MFTBDtls Clsg G1000 : $Closing Balance > 1000 Switch : Case 1 : MFTBDtls Clsg L1000 : $Closing Balance < 1000 [!Line : MFTBDtls Clsg G1000] Local : Field : MFTBDr Amt : Style : Normal Bold Local : Field : MFTBCr Amt : Style : Normal Bold [!Line : MFTBDtls Clsg L1000] Local : Field : MFTBDr Amt : Style : Normal Local : Field : MFTBCr Amt : Style : Normal In this code snippet, the condition specified in the switch sta tements will be checked one after another. The first statement satisfying the given condition will be exe cuted, and all other statements grouped within the label 'Case 1' will not be execut ed further, unlike 'Option'. The behaviour similar to 'Option' can be achieved by specifying dif ferent labels, if required. | TDL_Reference_Manual.pdf |
Symbols and Prefixes 37 Learning Outcome Access Specifiers and General symbols are the different special symbols used in TDL. The Access Specifiers @ and @@ are used for accessing the value s of Local and global formula, respectively. # can be used for referencing a field or modifying the existing definition. ## is used for accessing the value from a Local or Global varia ble. $ is used for accessing a method or UDF and $$ is used for call ing a function. | TDL_Reference_Manual.pdf |
TDL_Reference_Manual.pdf |
|
39 Dimensions and Formatting Introduction Dimensions are specifications. Dimensions in TDL are effective either in Display mode or in Print mode. Data in TDL does not have an absolute position of the dim ensions specified, but relative. There are four definitions in TDL that attract dimensions. They are FORM, PA R T, LINE and FIELD. 1. Unit of Measurement A Unit of Measurement can be any of the following: Millimeters/mms Centimeters/cms Inch(es) Number of Characters/Number of Lines % Screen/Page Number-Points (where 1 Point = 1/72 Inch) 2. Dimensional Attributes Dimensional Attributes can be classified into two, i. e., Specific and General Attributes. Table 4. 1 Dimensional Attributes The various dimensional attributes are as shown in the T able 4. 1 2. 1 Sizing/Size Attributes Height and Width The attribute 'Height' is used to specify the Height required f or the Form, Part and Line Definitions, whereas the attribute 'Width' is used to specify t he Width required for the Form, Part and Field Definitions. The Height and Width can be specified in ter ms of any of the above Units Definitions Specific Dimensions General Dimensions Form Height, Width, Space T op, Space Bottom, Space Left,Horizontal Align, Vertical Align, Full Height, Full Width Part Height, Width, Space T op, Space Bottom, Space Left, Space Right H o r i z o n t a l A l i g n, T o p P a r t s, Bottom Parts, Left Parts, Right Parts Line Height,Space T op,Space Bottom, Indent Full Height,T op Line, Bottom Line Field W i d t h, S p a c e L e f t, S p a c e Right, Indent Full Width, Left Field, Right Field, Widespaced | TDL_Reference_Manual.pdf |
Dimensions and Formatting 40 of Measurement. In the absence of any Unit of Measurement, the Hei ght assumes a certain number of lines and similarly, the Width assumes number of characters. The entire Height and Width is in the proportion of the available paper/screen dimensions. Syntax Height : <Measurement Formula> Width : <Measurement Formula> Height and Width-Form Definition The Height and Width, when specified in a 'Form' Definition, implies that it is the available Height and Width which can be utilized by all the Parts, Lines and Fie lds within the Form. If the contents of the Part and Line exceed the available Height and/or Width, the contents of the Form are squeezed to accommodate the same within the available Height an d Width. In the absence of any Height and Width specified, the Form Definition assumes the Hei ght and Width required by the contents of the Form, comprising of Parts, Lines and Fields. Example : Height : 10 inch Width : 8. 50 inch Height and Width-Part Definition Subsequently, Height and Width, when specified in a 'Part' Definition, impli es that it is the available Height and Width that can be utilized by all its Sub-Parts, Lines and Fields. If the contents of the Sub-Parts, Lines and Fields exceed the availabl e Height and Width, the contents of the Part are squeezed to accommodate the same within the ava ilable Height and Width. Example : Height : 10% Page Width : 60% Page Height-Line Definition Similarly, the Height, when specified within a 'Line' Definition, restric ts the contents of the Lines to the available Line Height. Generally, specifying the Line Height is not required since the contents of the lines are controlled by the given Part Height. Width-Field Definition The Width, when specified within a Field Definition, limits the contents of the Field within the defined boundary. If the contents are longer than the available Width, the Field c o n t e n t s a r e squeezed to accommodate the same within the defined width. Full Height and Full Width The Attribute 'Full Height' can be specified in a Form or a Line Definition, and the Attribute 'Full Width' can be specified in a Form or a Field Definition. ' Full Height' is used to instruct the Form or the Line to utilize the full Height, while 'Full Width' is used to instruct the Form or the Field to utilize the full Width. | TDL_Reference_Manual.pdf |
Dimensions and Formatting 41 Syntax Full Height : <Logical Value> Full Width : <Logical Value> Example : Full Height : No Full Width : No Full Height and Full Width-Form Definition The attribute 'Full Height' decides whether to allow the form to consume the full Height or not, depending on the logical value set. By default, the value set f or this attribute is YES. If the current Form uses Bottom Parts or Bottom Lines, then the Height require d/utilized by the Form will be 100% Page/Screen. Similarly, the attribute 'Full Width' decides whether to allow the Form to consume the full Width or not, depending on the logical value set. By default, the value set for this attribute is YES. If the current Form uses the Right Parts or Right Lines, then the Widt h required/utilized by the Form will be 100% Page/Screen. Full Height-Line Definition The attribute 'Full Height' decides whether the line can consume the full available Height or not, depending on the logical value set. By default, the value set t o this attribute is YES. Full Width-Field Definition The attribute 'Full Width' decides whether the Field can consume the full available Width or not, depending on the logical value set. By default, the value set t o this attribute is YES. 2. 2 Spacing/Position Attributes Space T op, Space Bottom, Space Left and Space Right Attributes Space T op, Space Bottom, Space Left and Space Right are used to specify the spaces to be kept to the T op, Bottom, Left and Right of the Definition. Space T op and Space Bottom can be used in Form, Part and Line Definitions. Space Left and Space R ight can be used in Form, Part and Field Definitions. When Space T op, Space Bottom, Space Left and Space Right are used in a definit ion, these spaces are included in the Height and Width specified within th e definition. Syntax Space Top : <Measurement Formula> Space Bottom : <Measurement Formula> Space Left : <Measurement Formula> Space Right : <Measurement Formula> Example : Space Top : 1. 5 inch Space Bottom : If ($$Is Stock Jrnl:##SVVoucher Type OR + $$Is Phys Stock:##SVVoucher Type) then 0 else 0. 25 | TDL_Reference_Manual.pdf |
Dimensions and Formatting 42 Space Left : @@DSPCond Qty SL + @@DSPCond Rate SL + @@DSPCond Amt SL Space Right : 1 Space Top, Space Bottom, Space Left and Space Right-Form/Part Definition The attributes Space T op, Space Bottom, Space Left and Space Ri ght are specified in a Form or a Part Definition, by leaving the appropriate spaces before displ aying/printing a Form. These spaces are included in the Height/Width of the Form Definition. Space Top and Space Bottom-Line Definition The attributes Space T op and Space Bottom, when specified in a Line Definition, leave the appropriate spaces before/after the Line. These spaces are incl usive within the Height of the specific Part in which the current Line Definition resides. If the Heigh t of the Part is unable to accommodate the same, it compresses the line to fit it within the available Height. Space Left and Space Right-Field Definition The attributes Space Left and Space Right, when specified in a 'Field' Definition, leave the appropriate spaces before/after the Field. These spaces are inc lusive within the Width of the Part and Field. If the Width of the Part is unable to accommodate the sa me, it compresses the Fields within the Parts and Lines, to fit it within the available Width. Indent An Indent can be specified either in a Line or a Field Definition. It is similar to the T ab Key which is used to specify a starting point for a Line or a Field. Syntax Indent : <Measurement Formula> Example : Indent : @@Indent By Level Indent-Line Definition This attribute in the Line Definition specifies the space to be left from the Left margin before the contents of the line begin. Indent-Field Definition This attribute in the Field Definition is similar to the Space Left attribute, except that it indents the field independent of width of the field. Space Left indents the field within the width available. However, Indent indents the field exclusive of the width. It can either take a formula as a parameter, or the expression itself. The formula can decide as to what ext ent each instance of the field has to be indented from the initial place. This attribute is typica lly used while displaying reports like List of Accounts, Trial Balance, etc., where the groups and led gers under a particular group are recursively indented inside the group, based on the order of th e groups and ledgers. 2. 3 Alignment Attributes T op Parts, Bottom Parts, Left Parts and Right Parts These attributes are used to place different parts at different positions in a particular Form or Part. The attributes 'T op Parts' and 'Bottom Parts' can be specified in 'Form' as well as 'Part' | TDL_Reference_Manual.pdf |
Dimensions and Formatting 43 Definitions, whereas attributes 'Left Parts' and 'Right Parts' can be specified only in the 'Part' Definition. Syntax Top Parts : <Part1, Part2,....> Bottom Parts : <Part1, Part2,....> Left Parts : <Part1, Part2,....> ;; Only for Part Definition Right Parts : <Part1, Part2,....> ;; Only for Part Definition Example : Top Parts : ACLSFixed Led, TDSAuto Details Bottom Parts : PJR Sign Left Parts : EXPINV Declaration ;; Attribute 'Left Parts' can be used only for 'Part' Definition Right Parts : STKVCH Address ;; Attribute 'Right Parts' can be used only for 'Part' Definition Top Parts and Bottom Parts-Form Definition In cases where the T op Part or Bottom Part is specified within a Form Definition, it occupies the T op Section or Bottom Section of the Form respectively, keeping in account the Space T op and Space Bottom of the Form. The attribute Space Bottom impacts th e Bottom Parts by moving them from the bottom, in order to leave appropriate spaces. Similarl y, Space T op impacts the T op Parts by moving them from the top, in order to leave appropriate spac es. The Bottom Parts/Bottom Lines start printing from bottom to the top of the Form. If Hei ght is specified at the Form Definition, then the Bottom Parts/Lines start printing from the bottommost line within the specified Height. Top Parts, Bottom Parts, Left Parts and Right Parts-Part Definition In cases where the Left Part or Right Part is specified within a Part Definition, it occupies the Left Section or Right Section of the Part respectively, keeping in view the Space Left and Space Right of the Part. The attribute Space Right impacts the Right Parts by moving them from Right, in order to leave appropriate spaces. Similarly, Space Left impacts the Left Parts by moving them from Left, in order to leave appropriate spaces. If the intent is to have multiple parts printed horizontally, then the Part Attribute 'Vertical' should be set to NO. In case s where the 'Vertical' Attribute is set to YES, all the parts within this part will be printed vertical ly. In su c h c a ses, the Left Parts will position at the T op of the Screen/Page and the Right Parts at t he Bottom of the Screen/Page. In cases where the T op Part or Bottom Part is specified within a Part Definition, it occupies the T op Section or Bottom Section of the Part respectively, keeping Space T op and Space Bottom of the Part in account. The attribute Space Bottom impacts the Bottom Parts by moving them from the bottom in order to leave appropriate space. Similarly, t h e a t t r i b u t e S p a c e T o p i m p a c t s t h e T o p Parts by moving them from the T op in order to leave appropriate spaces. If the intent is to have multiple parts printed vertically, then the Part Attribute Vertical should be set to Y es. If the Vertical Attribute is set to No, then all the parts within this part wil l be printed horizontally. In such | TDL_Reference_Manual.pdf |
Dimensions and Formatting 44 circumstances, the T op Parts will be positioned at the Left of the Screen/Page while the Bottom Parts are positioned at the Right of the Screen/Page. Top Lines and Bottom Lines These attributes are used to place different lines at different positions in a particular 'Part' Definition. The attributes 'T op Lines' and 'Bottom Lines' can b e specified in a Part Definition. However, the attributes T op Lines/Lines can only be used in a Line and F ield Definition. Syntax Top Lines : <Line1, Line2,..... > Bottom Lines : <Line1, Line2,..... > Example : Top Lines : Form Sub Title, CMP Action Bottom Lines : VCHTAXBILL Total Top Lines and Bottom Lines-Part Definition Attribute 'T op Lines' is used to place lines at the top, while attribute 'Bottom Lines' is used to place lines at the bottom of the Part, with respect to the Height spe cified within the 'Part' Definition. Left Field and Right Field The attribute 'Left Fields' can be specified in both Line and F ield Definition whereas the attribute 'Right Fields' can only be specified in a Line Definition. Syntax Left Fields : <Field1, Field2,....> Right Fields : <Field1, Field2,....> Example : Left Fields : Medium Prompt, Chg SVDate, Chg Vch Date Right Fields : Trader Typeof Purchase, Trader Qty Utilised Total Left Fields and Right Fields-Line Definition The attribute 'Left Fields' and 'Right Fields' specified in a ' Line' Definition, places the fields at their respective position. 'Left Fields' starts printing from the Lef t to the Right of the Line, while 'Right Fields' starts printing from the Right to the Left of the Line. If 'Repeat' Attribute is used in a Line, specification of 'Right Fields' is not allowed, as by default, the 'Repeat' Attribute places the Field specified to the Right of the Screen/Page. Left Fields/Fields-Field Definition Both Parts and Lines are not allowed together within a Part. They are mutually exclusive entities. Either Parts or Lines can be specified at a time, within a Part. | TDL_Reference_Manual.pdf |
Dimensions and Formatting 45 The attribute 'Field' is used to create fields containing one o r more fields, like Group fields. We can create multiple fields inside a single field, using the 'Fields' attribute. The attribute 'Fields' is useful when multiple Fields are required to be repeated in a Li ne. For example, in case of a Trial Balance, two Fields, i. e., Debits and Credits, are required to be repeated together if a new column is added by a user. The new column thus added, should again contain both these fie lds, i. e., Debit and Credit. In a Line Definition, only one Field can be repeate d. So, a Field is required within a Field if more than one field requires to be repeated. Align The attribute 'Align' aligns the contents of a Field as specifi ed. The permissible values for this attribute are Left, Center, Right, Justified and Prompt. Syntax Align : <String Value> Example : Align : Right Horizontal Align and Vertical Align 'Horizontal Align' sets the alignment of the Form or Part horiz ontally while 'Vertical align' sets the alignment of the Form vertically. Syntax Horizontal Align : <Logical Value> Vertical Align : <Logical Value> Example : Horizontal Align : Right Vertical Align : Bottom ;; Only for Form Definition The alignment of the Form or Part across the width of the page is set by the attribute 'Horizontal Align'. The default alignment of the Form and Part is in the Ce ntre of the screen, and on the Left on printing. Depending on the width of the Form and page, the Form or Part will be displayed or printed, leaving equal amount of space on the left and right of the Form. The alignment of the Form across the height of the page is set by the attribute 'Vertical Align'. The default alignment of the Form is Centre of the screen, and T op on print. Depending on the height of the form and page, the form will be displayed or printed, leaving equal amount of space on the top and bottom of the form. Widespaced This attribute is used in a 'Field' Definition to allow increas ed spacing between the characters of the string value specified in the field. It is used to create t itles for the report/columns. Syntax Widespaced : <Logical Value> Example : Widespaced : Yes | TDL_Reference_Manual.pdf |
Dimensions and Formatting 46 3. Some Specific Attributes 3. 1 Inactive The 'Inactive' attribute can be used in both a Field Definition and a Button Definition. When the attribute Inactive is set to YES in a Field Definition, the Fie ld loses its content but the size of the Field remains intact. In cases where a 'Button' Definition is u sed, the Button becomes Inactive. Syntax Inactive : <Logical Formula> Example : [Field : TBCr Amount] Set as : $Closing Balance Inactive : $$Is Dr:$Closing Balance In this example, the Field TBCr Amount is used to display the Credit Amount of the Ledger in a Trial Balance. When the Ledger Balance is Debit, the amount sho uld not be displayed in the Credit Column but the Width should be utilized to avoid the Deb it Field being shifted to the Credit Field. The Credit T otals to be calculated and displayed will al so exclude the Debit Amount. 3. 2 Invisible This attribute can be specified in a Part, Line or a Field Defi nition. Based on the logical condition, this attribute decides whether the contents of the definition s hould be displayed or not. When this attribute is set to YES, it does not display the contents, but the contents are retained for further processing. In this case, contrary to 'Inactive', the size of the entire field is reduce d to null, but the value is retained. Syntax Invisible : <Logical Formula> Invisible-Field Definition The 'Invisible' attribute, when specified in a Field, denotes that the current field is e xcluded from all the further processing, based on satisfying a certain condi tion. Example : [Field : Attr Invisible] Set as : “Invisible Attribute” Invisible : Yes In this example, the Field attribute 'Invisible' is used to dis play Credit Amount of the Ledger in a Trial Balance. When the Ledger Balance is debit, the amount sho uld not be displayed/printed in | TDL_Reference_Manual.pdf |
Dimensions and Formatting 47 the Credit Column and the Width is not utilized allowing the ot her fields to utilize the space. The Credit T otals being calculated and printed will also exclude th e Debit Amount. 4. Definitions and Attributes for Formatting 4. 1 Definition-Border The Definition 'Border' determines the type of lines required i n a border which can be used by a Part, Line or a Field; which means that this definition can def ine customized borders for the user. But, it is ideal to use predefined borders, which are part of d efault TDL, instead of user defined ones, since almost all possible border combinations are already defined in the Default TDL. Syntax [Border : <Border Name>] Top : <Values separated by a comma> Bottom : <Values separated by a comma> Left : <Values separated by a comma> Right : <Values separated by a comma> Color : <Color Name-B&W, Color Name-Color> Print FG : <Color Name> Attributes-T op, Bottom, Left and Right The T op, Bottom, Left and Right attributes in a 'Border' Defini tion are used to add appropriate lines which constitute the Border defined. The permissible values for these attributes are: Thin/Thick : This specifies whether the Line should be thin or thick. Flush : The border includes the spaces on the T op, Bottom, Left or Ri ght. Full Length : This ignores the space given at the T op, Bottom, Left or Righ t and prints the border for the whole length. Double : It forces double line to be printed. In its absence, single l ine is assumed. Example : [Border : Thin Bottom Right Double] Bottom : Thin, Flush, Full Length Right : Thin, Double [Field : Total Field] Set AS : $Total Border : Thin Bottom Right Double In a Report, at least one Part, Line and Field should be visible. | TDL_Reference_Manual.pdf |
Dimensions and Formatting 48 Attribute-Color The 'Color' attribute of the 'Border' Definition is used to spe cify the Color required for the border in 'Display' mode. In a 'Border' definition, the attribute 'Color' requires two values to be specified, viz. First value for a Black and White Monitor, and the second for a Color monitor. [Border : Top Bottom Colored] Top : Thin Bottom : Thin Color : "Deep Grey, Leaf Green" [Field : Total Field] Set AS : $Total Border : Top Bottom Colored Attribute-Print FG This attribute is used to specify the Color required for the bo rder during printing. [Border : Top Bottom Colored] Top : Thin Bottom : Thin Color : "Deep Grey, Leaf Green" Print FG : “Leaf Green” [Field : Total Field] Set AS : $Total Border : Top Bottom Colored 4. 2 Definition-Style The Definition 'Style' can be used in the 'Field' Definition on ly. This definition determines the appearance of the text being displayed/printed, by using a corr esponding font scheme, i. e., Bold, Italic, Point Size, Font Name, etc. The 'Style' attribute in 'F ield' Definition is used to format the appearance of the text appearing within the Field, both in Disp lay and Print mode, provided the 'Print Style' attribute is not used within the current Field. T he 'Print Style' attribute is used in Field, if the Style required while displaying is different from the Style required while printing. Syntax [Style : <Style Name>] Font : <Font Name> Height : <required Font Height in Point Size> Bold : <Logical Formula> | TDL_Reference_Manual.pdf |
Dimensions and Formatting 49 Italic : <Logical Formula> Attribute-Font It is a generic Font name supported by the Operating System. A Font is system dependent and we don't have any control over them. One can only select the re quired fonts from those available. Example : [Style : Normal] Font : if $$Is Windows then "Arial" else "Helvetica" Height : @@Normal Size [Style : Normal Bold] Use : Normal Bold : Yes [Field : Party Name] Set AS : $Party Ledger Name Style : Normal Print Style : Normal Bold Attribute-Height This attribute should be specified without any measurement, sin ce it is always measured in terms of Points. It can have value as a fraction, or as a formula whi ch returns a number. One can also grow or shrink the Height by a multiplication factor or percent age. Example : [Style : Normal Large] Use : Normal Height : Grow 25% Attribute-Bold The attribute 'Bold' can only take logical values/formula. In o ther words, it can take either a YES or NO. It signifies that the field using this Style should be prin ted in Bold. Example : [Style : Normal Bold Large] Use : Normal Large Bold : Yes Attribute-Italic | TDL_Reference_Manual.pdf |
Dimensions and Formatting 50 The attribute 'Italic' can only take logical values/formula. In other words, it can be set to either YES or NO. It signifies that the F ield using this Style should be printed in Italics. Example : [Style : Normal Large Italics] Use : Normal Large Italic : Yes 4. 3 Definition-Color The definition 'Color' is useful to determine the Foreground an d Background Color for a Form, Part, Field or Border, in Display as well as in Print Mode. A Color specification can be done by specifying the RGB V alues (the combination of Red, Green and Blue-each value should range from 0 to 255). Syntax [Color : <Color Name>] RGB : <Red>, <Green>, <Blue> Attribute-RGB This is the second way of specifying color. One can specify the RGB value from a palette of 256 colors to obtain the required color, i. e., the values Red, Green and Blue can each range from 0 to 255. This gives the user the option to select from the wide range o f 24 bit colors. Example : [Color : Pale Leaf Green] RGB : 169, 211, 211 [Field : Party Name] Set as : $Party Ledger Name Color : Pale Leaf Green Print FG : Pale Leaf Green 4. 4 Attributes 'Backgro und' and 'Print BG' The attribute ' Background' is used to set the Background Color of a Form, Part or a Field in Display mode. The ' Print BG' attribute is used to set the Background Color of a Form, Part o r a Field in Print mode. Syntax [Form : <Form Name>] Background : <Color Name Formula> Print BG : < Color Name Formula> [Part : <Part Name>] | TDL_Reference_Manual.pdf |
Dimensions and Formatting 51 Background : <Color Name Formula> Print BG : <Color Name Formula> [Field : <Field Name>] Background : <Color Name Formula> Print BG : <Color Name Formula> Example : [Form : Salary Detail Configuration] Background : @@SV_CMPCONFIG [Part : Party Details] Background : Red Print BG: Green [Field : Party Ledger Name] Background : Yellow Print BG : Red 4. 5 Attribute-Format The attribute 'Format' is used in the Field definition. It determines the Format of the value being displayed/printed within the Field. Syntax [Field : <Field Name>] Format : <Formatting Values separated by comma> The value for the Attribute 'Format' varies, based on the data type of the Field. Field of Type 'Number' Example : [Field : My Rate of Excise] Set AS : $Basic Rate Of Invoice Tax Format : “No Comma, Percentage” Field of Type 'Date' Example : [Field : Voucher Date] Set AS : $Date Format : “Short Date” Field of Type 'Amount' | TDL_Reference_Manual.pdf |
Dimensions and Formatting 52 Example : [Field : Bill Amount] Set AS : $Amount Format : “No Zero, No Symbol” Field of Type 'Quantity' Example : [Field : Bill Qty] Set AS : $Billed Qty Format : “No Zero, Short Form, No Compact” Learning Outcome The following four definitions in TDL attract dimensions: Form Part Line Field In TDL, Dimensional attributes are used for specifying the dime nsions. The Definition 'Style' determines the appearance of the text be ing displayed/printed by using the corresponding Font sche me, i. e., Bold, Italic, Point Size, Font Name, etc. The Definition 'Color' is useful to determine the Foreground an d Background color for a Form, Part, Field or Border, in Display as well as Print Mode. The attribute 'Format' is used in the Field Definition. It dete rmines the Format of the value being displayed/printed within the Field. | TDL_Reference_Manual.pdf |
55 Variables, Buttons and Keys Introduction A Variable is a storage location or an entity. It is a value that can change, depending on the conditions or on the information passed to the program. The actions in TDL can be delivered in three ways: by activatin g a Menu Item, by pressing a Key or by activating a Button. The definitions of both Buttons and Keys are the same, but at t he time of deployment, Keys differ from Buttons. 1. Variable In TDL, a V ariable is one of the important definitions, since it helps to control the behaviour of Reports and their contents. V ariables assume different values during execution and these v alues affect the behaviour of the Reports. A V ariable definition is similar to any other definition. Syntax [Variable : <Variable Name>] Attribute : Value A V ariable should be given a meaningful name which determines i ts purpose. 1. 1 Attributes of a Variable The attributes of a V ariable determine its nature and behaviour. Some of the widely used attributes are discussed below: Ty p e This attribute determines the Type of the value that will be he ld 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 defa ult. 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. | TDL_Reference_Manual.pdf |
Variables, Buttons and Keys 56 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> V alue of the variable should adhere to the data type specified with 'Type' Attribute. Example : [Variable : DSP Has Column Total] Type : Logical Default : Yes The Default Initial V alue for the logical V ariable DSP Has Column T otal is set to YES. This variable will begin with an initial value YES in the Reports, unless ove rridden by the System Formula. We will learn about the System Formula in the coming sections. Persistent This attribute decides the retention periodicity of the attribu te. If the attribute 'Persistent' is set to YES, then the latest value of the variable will be retained acr oss the sessions, provided the variable is not a local variable. We will learn about the concept of local and global variables s hortly. 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 b een set to YES, which means that it retains the latest path given by the user even during the concu rrent sessions of T ally. V olatile In cases where the 'Volatile' attribute in the V ariable definit ion 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 v ariable 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. | TDL_Reference_Manual.pdf |
Variable, Buttons and Keys 57 Syntax [Variable : <Variable Name>] Volatile : <Logical Value> Example : [Variable : Group Name] Type : String Volatile : Yes The 'Volatile' attribute of Group Name V ariable is set to YES, which means that the variable 'Group Name' can store multiple values, which have been receive d from multiple reports. Repeat This attribute is mainly used to achieve the Auto Column behavi our in various Reports. E a c h Column is created with a subsequent Object in a Collection auto matically, till all the columns required for Auto Columns exhaust. The 'Repeat' attribute has i ts value as a variable which has the collection of Objects, for which the columns need to be gen erated. Every time the Repeat is executed, the column for the subsequent Object is added. Syntax [Variable : <Variable Name>] Repeat : <Variable Value> Example : [Variable : SV From Date] Type : Date Volatile : Yes Repeat : ##DSPRepeat Collection ##DSPRepeat Collection V ariable receives the Collection Name from a Child Report, whic h accepts inputs from the user regarding the columns required. V a riable SVFrom Date gets repeated over the subsequent period in the Collection each time the column repeats. 1. 2 The Scope of a Variable The scope of a V ariable can be br oadly classified as follows: Local Global Field acting as a variable Local A V ariable is termed as a local variable when it is associated to a Report. This means that the scope of the variable covers only the current report and its co mponents. It is not mandatory for local variables to have an initial value. | TDL_Reference_Manual.pdf |
Variables, Buttons and Keys 58 Syntax [Report : <Report Name>] Variable : <Variable Name> Example : [Report : Balance Sheet] Variable : Explode Flag Explode Flag V ariable is made local to the Report 'Balance Sheet' by associa ting it using the Report attribute 'V ariable'. This variable retains its value as long as we work with this Report. On exiting the Report, the original value if given, is returned an d the value modified within this report is lost. For example, consider a situation where 'Stock Summary ' Report is being viewed with Opening, Inwards, Outwards and Closing Columns enabled through Configuration settings. Once we quit this Report and re-enter the Report, the variables retu rn to the default settings. Global A variable is termed as Global variable when it is defined unde r System V ariable section. It means that the scope of the variable covers all reports. An initial v alue is mandatory for global variables. Syntax [System : Variable] Variable : <Initial Type Based Value> Example : [System : Variable] BSVertical Flag : No The BSVertical Flag V ariable is made Global. Hence, this variable value being modif ied in a Report is retained, even after we quit and re-enter the Report. The retention of a Global V ariable can be done on two levels, i. e., either within the current sess ion or across the sessions. If the Variable attribute 'Persistent' is set to YES, then the modifie d variable value is retained across the sessions, else the value defaults back to initial value on re-entering another session of T ally. A Global Variable can also be made local to a Report by associating it to a Report, as discussed in Local Variables above. All the Persistent Variable Values are stor ed in a File Named T ally Sav. Cfg, in the folder path specified in T ally. ini. Each time T ally is restarted, these variable values are accessed from this file. | TDL_Reference_Manual.pdf |
Variable, Buttons and Keys 59 Field Acting as a Variable The Variable attribute in a 'Field' Definition is used to make the Field beh ave as a V ariable. when value is entered/altered in a Field, the variable assumes the s ame value with immediate effect. The V ariable need not be defined previously, since it inherits its data type from the Field itself. For example, in a Trial Balance Report, which is a drill down report, there is a need to retain the Group Name which has been selected by the user. So, each time the user scrolls up and down, the field value changes and the current field value is passed o n to the variable immediately, so that if the current group is selected and drilled down, the report begins with the sub groups and ledgers of the selected group. Syntax [Field : <Field Name>] Variable : <Variable Name> Example : [!Field : DSP Group Acc] Variable : Group Name This is used in the 'List of Accounts' Report in T ally. ERP 9, wherein the optional Field DSP Group Acc is made to act as a variable by using the Field attribute 'V ari able', and the value selected by the user is passed on to this variable for further use. 1. 3 Modifying the Variable Value A Field attribute Modifies is used to modify the value of a variable. Syntax [Field : <Field Name>] Modifies : <Variable Name> Example : [Field : SLedger] Modifies : SLedger The SLedger V ariable is modified with the value stored/keyed in the Field SLedger The Variables used in a Field Acting as a Variable are local variables, and are local to the Report. | TDL_Reference_Manual.pdf |
Variables, Buttons and Keys 60 1. 4 Example-Variables The following code snippet explains the usage of Local variable. [Variable : Loc Var] Type : String Default : "This is the default value" ;; Variable Loc Var of T ype String is defined and it is assigned a Default Value [Report : Local Variable] Variable : Loc Var ;; At this point, Variable Loc Var becomes a Local Variable for this Report [Field : Local Variable Field] Set As : "This is a Local Variable in Report" Modifies : Loc Var ;; Here, the variable value is modified with the Field contents specified in 'Set As' In this code snippet, a local variable Loc Var is defined and locally attached to the Report 'Local V ariable'. This Report modifies the V ariable V alue to 'This is a Local Variable in Report'. Once we exit from this Report, the value of the variable locvar modi fied in this Report is lost. 2. Buttons and Keys The actions in TDL can be delivered in three ways-by activating a Menu Item, by pressing a Key or by activating a Button. The definition of both Buttons and Keys are the same, but at th e time of deployment, Keys differ from Buttons. All the Buttons used within the attribute 'Buttons' are visible on the button bar, so that the user can either click it or press the unique key combination. All the Bu ttons used within the attribute 'Keys' are invisible entities and the key combination associated in th e Key must be pressed to activate a key; whereas to activate a button, either it can be clicked or the key combination assigned for the button can be pressed. | TDL_Reference_Manual.pdf |
Variable, Buttons and Keys 61 2. 1 Attributes of Buttons/Keys Title The 'Title' attribute can be used to give a meaningful Title to the Button being displayed on the Button Bar. This attribute is optional. Syntax [Key/Button : <Key/Button Name>] Title : <Button Title> Example : [Button : Non Columnar] Title : “No Columns” Key/Keys This attribute is used to give a unique key combination, which can be activated by pressing the same from any Report or Menu. This attribute is mandatory if ac tion is specified in this definition. Syntax [Key/Button : <Key/Button Name>] Key : <Combination of Keys> Example : [Button : Non Columnar] Key : Alt + F5 Action The Action attribute is used to associate an Action with the Button. Every Button or Key is defined for the purpose of executing certain predefined actions. Syntax [Key/Button : <Key/Button Name>] Action : <Required Action> Example : [Button : Non Columnar] Action : Set : Columnar Day Book : NOT ##Columnar Day Book In case the Title is not specified, then by default, it assumes the Button Name as its title. In cases wh ere it is used as a Key, the Title is ignored, since the Keys are hidden in a Menu or a Report. | TDL_Reference_Manual.pdf |
Variables, Buttons and Keys 62 Inactive The Inactive attribute is used to activate the Button, based on some condition. If the condition is FALSE, the button will be displayed, but it cannot be activated. Syntax [Key/Button : <Key/Button Name>] Inactive : <Logical Condition> Example : [Button : Close Company] Inactive : $$Selected Cmps < 1 Learning Outcome A variable is a storage location or an entity. It is a value that can change, depending either on the conditions or on the information passed on to the program. The V ariable attribute 'Type' d etermines the Type of value that will be held within it. The attribute 'Default' is used to assign a default value to a variable, based on the 'Type' defined. The attribute 'Persistent' decid es the retention periodicity of the attribute. The attribute 'Modifies' in a Field definition is used to modif y the value of a variable. 'Title', 'Key', 'Action' and 'Inactive' are the attributes of ' Button' definition. | TDL_Reference_Manual.pdf |
63 Objects and Collections Introduction In the previous lesson, the usage of V ariables, Buttons and Key s were explained. In this lesson, the concept of 'Objects' and 'Collections' will be discussed in detail. Let us try to understand what an object is in general, its importance and usage in TDL. 1. Objects Any information that is stored in a computer is referred to as Data. Database is a collection of information organized in such a way that a computer program can quickly select desired data. A database can be considered as an electronic filing system. T o a ccess information from a database, a Database Management System (DBMS) is used. DBMS all ows to enter, organize, and select data in a database. The organization of data in a database is referred to as the 'D atabase Structure'. The widely used database structures are hierarchical, relational, network and o bject-oriented. In the hierarchical structure the data is arranged in a tree-li ke structure. This structure uses the parent-child relationships to store repeating information. A pa rent can have multiple children, but a child can have only one parent. The child in turn can have multiple children. Information rela ted to one entity is referred to as an object. A database is a group o f interrelated objects. An object is a self-contained entity that consists of both data, and procedures to manipulate the data. It is defined as an independent entity, based on its properties and behaviour/functionality. Objects are stored in a data base. A relationship can be created between the objects. As discussed, the hierarchical structure has a parent-child relationship. For example, child objects can inherit characteristics from pa rent objects. Likewise, a child object can not exist without a parent object. After discussing the object concept in general, let us examine the T ally object structure in the following section. 1. 1 T ally Object Structure The T ally data base is hierarchical in nature, in which the obj ects are stored in a tree-like structure. Each node in the tree can be a tree in itself. An ob ject in T ally is composed of methods and collections. Method is used to retrieve data from the database. A collection is a group of objects. Each object in the collection can further have methods and coll ections. The structure is as shown in Figure 6. 1. | TDL_Reference_Manual.pdf |
Objects and Collections 64 Figure 6. 1 T ally Object Structure Everything in TDL is an Object. As mentioned in the earlier cha pters, Report, Menu, Company, Ledger, etc., all are objects in TDL. The properties of objects in TDL are called Attributes. For example, the attributes 'Object', 'Title', 'Form' are all prope rties that define the 'Report' object. An object can have Methods and Collections, as mentioned earlie r. F o r e x a m p l e, t h e O b j e c t 'Ledger' contains the Methods 'Name', 'Parent', etc., and the collections 'Address' and 'Billwise Details'. As shown in the Figure 6. 1, the Objects available at Level 1 ar e referred to as Primary objects and objects which are at Level 2-n are referred to as Secondary obj ects. Two different types of objects are available in TDL. The follow ing section describes the classification of objects in TDL. | TDL_Reference_Manual.pdf |
Objects and Collections 65 1. 2 T ally Objects T ypes Objects in TDL are classified into two types, based on the thei r usage and behaviour, as follows: Interface Objects Data Objects Interface objects define the user interface while Data objects store the value in the T ally Primary or Secondary database. Any data manipulation operation on the d ata object is performed through Interface objects only. Figure 6. 2 shows the classification of objects in TDL. Figure 6. 2 Classification of Objects Interface Objects Objects used for designing the User Interface are referred to a s Interface objects. Report, Form, Menu, etc., are interface objects. Interface objects like Report and Menu are independent items and can exist on their own. The objects Form, Part, Line, Field can't exist independently. They must follow the containment hierarchy as mentioned in the secti on 'Basic TDL Structure' of Lesson 2-'TDL Components'. Example : [Field : Sample Fld] Width : 22 [Line : Sample Ln] Field : Name Field | TDL_Reference_Manual.pdf |
Objects and Collections 66 TDL allows a re-usage of all the objects. There are two ways to obtain some more properties that are required in an object: The existing object can either be used in new objects or in lie u of defining a new object. The existing object can be modified to add new properties. The interface objects can be shared by other interface objects. For example, a single field can be used in multiple lines. The follow ing examples describe the dis cussed scenarios: Example : 1 [Field : Sample Fld] Width : 22 Set As : “TDL Demo” [#Field : Sample Fld] Style : Normal Bold The field Sample Fld will have both the properties. The width of the field is 22 and t e x t i s displayed using the style Normal Bold. Example : 2 [Field : Sample Fld] Width : 22 Set As : “TDL Demo” [Field : Sample Fld1] Use : Sample Fld Style : Normal Bold The field Sample Fld1 will have both the properties. The width of the field is 22 and the text is displayed using the style Normal Bold. Example : 3 [Line : Title A] Field : Name Field [Line : Title B] Field : Name Field The field Name Field is used in both the lines Title A and Title B. A set of available attributes of interface objects are predefin ed by the platform. A new attribute can not be created for an interface object. | TDL_Reference_Manual.pdf |
Objects and Collections 67 Interface objects are always associated with a Data Object and essentially add, retrieve or manipulate the information in Data Objects. Data Objects Data is actually stored in the Data Objects. These objects are classified into two types viz., Internal objects and User defined objects/TDL objects. Internal Objects Internal objects are provided by the platform. They are stored in the T ally Database. Multiple instances of internal objects can exist. In T ally. ERP 9, intern al objects are of several types. Examples of internal objects are Company, Group, Ledger, Stock, Stock Item, Voucher Type, Cost Centre, Cost Category Budget, Bill and Unit of Measure. User Defined Objects/TDL Objects All the Objects which are defined by the user in TDL are referred to as User Defined Objects or TDL objects. User defined objects are further classified as Static Objects or Dynamic Objects. Static TDL Objects cannot be stored in T ally Database. The data for the Static obj ect is hard coded in the program and can be used for display purpose only. Dynamic TDL Objects can be created from the data available in any of the following external data sources: XML Files from remote HTTP server DLL files From any type of database through ODBC In TDL, the data from all these external data sources is availa ble in a collection. Example of Internal Objects and TDL Objects Static TDL Objects/External Objects As discussed earlier, a user can create Static TDL Objects for which the data is har d coded. Consider the following exam ples of Employee Details. Employee Details In TDL, two objects have to be created such that Emp No, Name, Date and Designation become the attributes of the object. The code snippet to create these objects is as shown: [Object : Emp 1] Emp No : E001 Name : “Krishna” Date : Aug 01 Designation : Manager | TDL_Reference_Manual.pdf |
Objects and Collections 68 [Object : Emp 2] Emp No : E002 Name : “Radha” Date : Aug 01 Designation : “Asst. Manager” Internal Objects Consider the data for a ledger object which has multiple bill d etails associated with it. Ledger Details This hierarchical structure s hows that the ledger 'Krishna' is created under the group 'Sundry Creditors'. It further contains multiple bill details. The Ledg er Name is 'Krishna', the parent group is 'Sundry Creditors' and the closing amount is 3 000. The two bills 'Bill 1' for the amount 10 00 and 'Bill 2', for the amount 2 000, are associated with the ledger Krishna. 1. 3 Object Context Each Interface object exists in the context of a Data Object. A n Interface object either retrieves information from the Data Object or stores information into the Data Object. The association of the Interface object with a Data Object can be done at the Report, Part, Line and Field level. All the methods of the associated Data Object are available in the Inte rface object, which is said to be in the 'Context' of the associated Data Object. The data is always retrieved from the database in context of th e current object. All the data manipulation operations are performed on the object in context only. Any expression such as Formulae, Methods and so on which are ev aluated in the Interface object, will be in the 'Context' of the Data Object. Please refer to the Appendix for the detailed structure of Internal Objects and Methods. | TDL_Reference_Manual.pdf |
Objects and Collections 69 T o understand the concept of object context, consider the following example: When the Interface object 'Report' is associated to the Data Ob ject 'Ledger', then all the methods and collection of the Ledger object can be referenced in the as sociated report. The Method $Name, when used in the field, will display the name of the Led ger object associated at the Report level. If no object is associated at the Report level, t hen no data will be displayed in the field, since there is no object in the context. 2. Collections A Collection is termed as a group of objects. It refers to a collection of zero or more objects. The objects in the collection can be obtained either from the T ally database, or from external data sources, e. g., XML file. In default TDL, many collections are defined which are referred to as Internal Collections. The collections created by a user are called user defined collectio ns. Object in a collection follow the T ally object structure, i. e., each object of the collection can conta in Methods, Collections, and so on. A collection can be a collection of objects or a collection of collections. Figure 6. 3 shows the collection of objects. Figure 6. 3 Collection of objects The collection of collections is referred to as a Union of coll ection. This capability will be discussed in detail in the section Collection Capabilities. In TDL, the collections are of two types: Simple collection and Compound collections. | TDL_Reference_Manual.pdf |
Objects and Collections 70 2. 1 T ypes of Collection Collections can have multiple Methods and Collection. They are classified as Simple Collection and Compound Collection based on the constituents of the collec tion. Figure 6. 4 The classif ication of collection Simple Collections Simple collections contain only a single method which is repeat able. Simple Collections cannot have sub-collections. The Name and Address are examples of Simp le Collections. Compound Collections The collections which have sub-collections and multiple methods are called Compound Collection. Any Internal or External Collections of Primary or Secondary or user defined objects is an example of a Compound Collection. In both Simple and Compound C ollections, the index can be used to fetch user-defined or internal methods of the Object. T he Index can be either First or Last. After describing the classification of a Collection, the follow ing topic describes the various data sources of a Collection. | TDL_Reference_Manual.pdf |
Objects and Collections 71 2. 2 Sources of Collection 'Collection', the data processing artefact of TDL, provides ext ensive capabilities to gather data not only from T ally database, but also from external sources using ODBC, DLLs and HTTP. Based on the source of data, the collections are referred to as External collection, ODBC collection, HTTP XML collection and Aggregate/summary collectio n. The Collection of Internal Objects In cases where a collection contains objects from T ally databas e, it is referred to as an Internal Collection. In the collection of internal objects, the attribut es used are Type, Child Of, Belongs T o. External Collection The collection of static TDL objects are referred to as an Exte rnal Collection. The attribute used to create an external collection is 'Object'. ODBC Collection The Data Objects populated in the collection are from an extern al database using ODBC. The attributes used are ODBC, SQL, S QL Objects, SQL Parms and SQL V alues. HTTP XML Collection The Objects of this collection are obtained from the XML file u sing HTTP. The file can be made available either on the local machine or on the remote server. The attributes used in creating an XML collections are 'Remote URL', 'Remote Request', 'XML Object Path' and 'XML Object'. DLL Collection A collection can be populated with objects obtained by executin g a DLL file. The DLL's can be written using an external application to extend the existing fu nctionality of T ally. This allows the users to extend the kernel capability by adding their own funct ions. External Plug-Ins are written as DLL's and can be of two types: C++ DLL's Active X DLL's In order to create the Collection that calls an external Plug In the following attributes are used. V alues can be passed to the DLL's as parameters. Syntax [Collection : My DLL Collection] Plug-In : <path to dll>. <p Input param> Active X Plug-In : <Project Name>. <Class Name>. <p Input param> The value returned by executing the DLL will be available as ob jects in the collection. 2. 3 Creating a Collection TDL provides a set of attributes to create a collection and pop ulate it with objects obtained from various data sources. The set of attributes used in the collect ion is based on the data source as mentioned in the section Sources of Collections. This section d escribes the attributes used in the creation of an internal and external collection. Creating colle ctions from various data sources will be explained later. | TDL_Reference_Manual.pdf |
Objects and Collections 72 Collection of Internal Objects T o create a collection of internal objects, the attribute 'Type ' is used. It accepts object type name as the value. The collection definition for creating an internal collection has the following syntax. Syntax [Collection : <Collection Name>] Type : <Object Type> Where, <Collection Name> is a user defined name for the collection. <Object Type> is the name of any of the internal objects, e. g., Group, Stock Item, Voucher, etc. Attribute-T ype This attribute is used to define a collection of a particular T ype or Subtype. This attribute can take values of the default TDL objects as well as the user defined f ields (UDF). Syntax Type : <Object Type> [: <Parent Type>] Where, <Object Type> is the name of the object type or its sub-type. <Parent Type> is optional and is required if the subtype is to be specified. Example : [Collection : My Collection] Type : Ledger The collection My Collection consists of a collection of Ledgers which is an Internal object. External Collection T o create a collection of Static TDL objects the attribute used is Object. The collection definition for creating external collection has the following syntax: Syntax [Collection : <Collection Name>] Object : <Object Name>, <Object Name>,......., <Object Name> Where, <Collection Name> is the user defined name for the collection. <Object Name> are the names of user-defined objects. Attribute-Object The 'Object' attribute is used to create a collection of user-d efined objects. A collection can have multiple collections/objects in it. Syntax Object : <List of Objects> | TDL_Reference_Manual.pdf |
Objects and Collections 73 Where, <List of Objects> is a comma-separated list of objects. Here, the objects are defined using the 'Object' definition, as shown in the following example. Example : [Collection : Emp] Object : Emp1, Emp2 [Object : Emp1] Emp Name : "Ram Kumar" Age : "25" [Object : Emp2] Emp Name : "Krishna Yadav" Age : "30" The Objects of Collection 'Emp' has the Methods 'Emp Name' and ' Age'. In TDL, Methods are used to retrieve data from Objects and Coll ections. The following section explains the Usage and Types of methods. 3. Object Association Object Association is the process of linking an Interface Objec t with one or more Data Objects. Each Interface Object must be in the context of a Data Object. A TDL programmer can associate an Interface Object with any Data Object. If a Interface object is not explicitly associated with any Data Object, then Anonymous Object is associated to it. Anonymo us Object is a Primary data Object provided by platform. It has no methods, sub-collections, or parameters. Object Association can be done at the following levels: Report Level Association Part Level Association Line Level Association Field Level Association Once an Object is associated at the T op level, the child level Interface Objects inherit it, unless it is explicitly overridden. If there is no explicit association of t he Data Object at the Report level, it is associated with the Anonymous Object. 3. 1 Report Level Ob ject association A Report is normally associated with a data object, which it ge ts from the previous Report and if not, will be associated with the anonymous object. From Release 3. 0 onwards, the syntax for association has been enhanced to override the default associati on as well. The Report attribute 'Object' has been enhanced to take an additional optional value as 'Object Identifier Formula'. | TDL_Reference_Manual.pdf |
Objects and Collections 74 Syntax Object : <Object Type> [: <Object Identifier Formula>] Where, <Object Type> is a Type of Primary Object. <Object Identifier Formula> is an optional value and refers to any formula which evaluates the name of Primary Object. Example 1: Without the Object Identifier [#Form : Sales Color] Delete : Print Add : Print : New Sales Format [Report : New Sales Format] Object : Voucher Default Sales Color Form is modified to have a new print format 'New Sales Format'. This Report gets the voucher object from the previous Report. Example 2: With the Object Identifier [Report : Sample Report] Object : Ledger: “Cash” The Ledger 'Cash' is associated to the Report 'Sample Report'. Now components of a 'Sample Report' by default, inherit this ledger object association. 3. 2 Part Level Object Association Part inherits the Object from the Report/Part/Line, by default. This can be overridden in two ways. Using the 'Object' attribute specification in the Part definiti on The syntax of an Object attribute at the part level is as follo ws: Syntax Object : <Supplier Collection> : <Seek Type Keyword> [: <Seek Condition>] Where, <Supplier Collection> is the name of the Collection of Secondary Objects. <Seek Type Keyword> can be First or Last, which denotes the position index. <Seek Condition> is an optional value, and is a filter condition to the Supplier collection. Example: Part in the Context of Voucher Object [Part : Sample Part] Line : Sample Line Object : Inventory Entries:First:@@Stk Name Filter | TDL_Reference_Manual.pdf |
Objects and Collections 75 Scroll : Vertical [System : Formula] Stk Name Filter : $Stock Item Name = "Tally Developer” The first inventory entry having stock item “T ally Developer” i s associated with Part 'Sample Part'. Only sub-objects can be associated at part level for whic h the primary object is associated at the Report level. T o overcome this limitation a new attribute 'Obje ct Ex' is introduced at part level in release 3. 0. Using 'Object Ex' attribute specification in Part definition The attribute 'Object Ex' provides the ease of using enhanced m ethod formula syntax, while specifying the object association. Now even the Primary Object can be associated to a Part, which was not possible with the Object attribute of 'Part' Definition. Syntax Object Ex : <Method Formula Syntax> Where, <Method formula syntax> is, <Absolute Spec>. [<Sub Object Spec>]<Absolute Specification> is (<Object Type>, <Object Identifier Formula >). If only Absolute Spec. is given, then it should end with dot ('. '). <Sub Object Specification > is Collection Name[Index,<Condition>] Example : 1 [Part : Sample Part] Object Ex : (Ledger,"Customer") The Ledger object “Customer 1” is associated to the Part 'Sampl e Part'. Since only the absolute specification used, the Object specification is ends with '. ' Example : 2 [Part : Sample Part] Object Ex : (Ledger,"Customer"). Bill Allocations[1,@@Condition1] [System : Formula] Condition1 : $Name = "Bills 2" The Secondary Object 'Bill Allocation' is associated with the P art 'Sample Part'. The Data Object associated to some other Interface Object can a lso be associated to a Part. This aspect will be elaborated in the section 'Object Access via UI Object' of the Enhancement training. The enhanced method formula syntax is discussed in detail unde r the section 'Accessing Methods '. | TDL_Reference_Manual.pdf |
Objects and Collections 76 3. 3 Line Level Object Association An object can be associated to a Line by Part attribute 'Repeat '. Now, the Part attribute 'Repeat' is enhanced to support the following. Extraction of collection from any Data object. Extraction of collection from UI Object associated Data object. This aspect will be elaborated in the section “Object Access via UI Object”. Attribute-Repeat Syntax Repeat : <Line Name> : <Coll Name> : [<Supplier Coll> : <Seek Type Keyword> : <Seek Condition>] Where, <Coll Name> is the name of the Collection. If the Collection is present in one level down of the object hierarchy, then Supplier Collection needs to be mentioned. <Supplier Collection> is the name of the Collection of secondary Objects. <Seek Type Keyword> can either be First or Last which denotes the position index. <Seek Condition> is an optional value and is a filter condition to the supplier collection. Example: Part in the context of Voucher Object [Part : Sample Part] Line : Sample Line Repeat : Sample Line: Bill Allocations: Ledger Entries: First: + @@Led Formula [System : Formula] Led Formula : $Ledger Name = “Customer” The Line 'Sample Line' is repeated over Bill Allocations of fir st Object 'Ledger entries', which satisfies the given condition. Alternate 'Repeat' Syntax Instead of specifying the '<Co ll Name>:[<Supplie r Coll>:<Seek Ty pe Keyword>: <Seek Condition>]', the new method formula syntax can be used as follows: Syntax Repeat : <Line Name> : <Method Formula Syntax> Where, <Method Formula Syntax> is <Absolute Spec>. <Sub Object Spec> <Absolute Spec> is (<Object T ype>, <Object Identifier Formula> ) <Sub Object Spec> is Collection Name[Index,<Condition>] | TDL_Reference_Manual.pdf |
Objects and Collections 77 Example : [Part : Sample Part] Line : Sample Line Repeat : Sample Line : (Ledger, “Customer”). Bill Allocations The Line 'Sample Line' is repeated over Bill Allocations of Obj ect Ledger for Customer ledger. 3. 4 Field Level Ob ject Association By default, it is inherited from the Parent line or Field (if f ield is inside a field). This cannot be overridden. However Field also allows Object Specification synt ax. This association, if specified, acts as the 'Secondary Context Object' for the Field. During any for mula evaluation, if the formula/method fails in the context of the Primary Object, the Secondary Object is tried then. 4. Methods Each piece of information stored in the data object can be retr ieved using a method. A method either performs some operation on the object, or retrieves a value from it. T o retrieve the value from database, the storage name is prefixed with $ symbol. TDL provides pre-defined methods and allows the user to create methods as well. Methods are clas sified as Internal or External. 4. 1 T ypes of Methods Internal Methods The methods which are defined by the platform are called as Int ernal Methods. For example, the methods Name, Address and Parent are the internal Methods of Ob ject 'Ledger'. User Defined/External Methods A user can change the behaviour or perform an action on the int ernal object by defining new Methods. Methods defined by the user are referred to as Externa l/User-defined methods. Example: A Method 'Diff Bal' can be created for an Object 'Ledger', which gives the difference of the total debit amount and total credit amount. 4. 2 Accessing Methods Methods of an object can be accessed in TDL in three different ways, based on the object context. Accessing data from the current Object Incase you are already in the object context, use the Method na me prefixed with $ directly. Syntax $<Method Name> Where, <Method Name> is the name of the Method of the object in context. Example : $Company Name | TDL_Reference_Manual.pdf |
Objects and Collections 78 Accessing by Reference In cases where the user is not in the object context, or is in a different object context then following syntax may be used: Syntax $<Method Name> : <Object Name>:<formula> Where, <Method Name> is the name of the Method, which belongs to the Object. <Object Name> is the name of the Object. <Formula> is the value, based on which, the Method value is retrieved. Example : $Name : Ledger : ##SVLedger Name Accessing by using the Index In cases where the user is not in the object context, or in a d ifferent object context, the following syntax may be used: Syntax $<Method Name> : < Collection Name> : <Seek Type> Where, <Method Name> is the name of the Method which belongs to the Collection. <Collection Name> is the name of the Collection. <Seek Type> is the searching direction. It can either be First or Last. Example : $Ledger Name : Ledger Entries:First Directly Accessing Data from Any Object The Method formula syntax allows direct access to any object Me thod, including its sub-collections to any level, with a dotted notation framework. The values from any object anywhere can be accessed, without making the object as the current object. This syntax is introduced to support access out of the scope of the Primary Ob ject and to access the Sub object at any level using (. ) dotted notation, with index and condition support. Syntax $<Primary Object Spec>. <Sub Object Path Spec>. Method Name Where, <Primary Object Spec> can be ( <Primary Object T ype Keyword>, <Primary Object Identifier Formula> ) <Sub Object Path Spec> is given as the Collection Name [<Index Formula>, [<Condition>]] <Method Name > refers to the name of the Method in the specified path. <Index Formula> should return a number, which acts as a position specifier in t he Collection of Objects matching the given <condition> | TDL_Reference_Manual.pdf |
Objects and Collections 79 Example: Assuming that the Voucher is the current object 1. T o get the Ledger Name of the first Ledger Entry from the cur rent Voucher : Set As :$Ledger Entries[1]. Ledger Name 2. T o get the amount of the first Ledger Entry on the Ledger Sal es from the current voucher (Sales Invoice) : Set As : $Ledger Entries[1,@@Ledger Condition]. Amount Ledger Condition : $Ledger Name = “Sales” 3. T o get the first Bill Name of the first Ledger entry on the P arty Ledger from the current voucher (Sales Invoice) : Set As : $Ledger Entries[1,@@Ledger Condition]. Bill Allocaions[1]. Name Ledger Condition : $Ledger Name = @@Inv Party Name 4. T o get the Opening Balance of the first Bill for the Party Le dger Acme Corp: Set As : $(Ledger,@@Party Ledger). Bill Allocations[1]. Opening Balance Party Ledger : “Acme Corp” The Primary Object specification is optional. If it is not spec ified, the current object will be considered as the Primary Object. A Sub-Collection specificatio n is optional. If not specified, Methods from the current or specified primary object will be made avail able. The Index specifies the position of the Sub-Object to be picked up from the Sub-Collect ion. This Condition is 'Filter' which is checked on the objects of the specified Sub-Collection. <Primary Object Identifier Formula>, <Index Formula> and Condition can be a value or formula. The Index Formula can be any formula evaluating to a number. The Positive Number indicates a forward search while a negative number indicates a backward sea rch. This can also be a keyword First or Last, which is equivalent to specifying 1 or-1 respectively. In cases where both the Index and Condition are specified, the index is applicable on the Object(s) which satisfies the condition so that one gets the nt h Object which clears the condition. Let's say for example, if the Index specified is 2 and Conditio n is Name = 'Sales', then the second object which matches the name 'Sales', will be picked up. The Primary Object Path Specification can either be Relative or Absolute. A Relative Path is referred to by using empty parenthesis () or a dotted path to r efer to the Parent object relatively. A SINGLE DOT denotes the current object, DOUBLE DOT the Parent Ob ject, TRIPLE DOT the Grand Parent Object, and so on, within an Internal Object. The Absolute Path refers to the path in which the Primary Object is explicitly specified. T o access the Methods of Primary Object using a Relative Path, the following syntax is used. Syntax $(). <Method Name> or $..<Method Name> or $... <Method Name> | TDL_Reference_Manual.pdf |
Objects and Collections 80 Example : With regard to the context of Ledger Entries Object within Vouch er Object, the following have to be written to access the Date from its Parent Object which is the Voucher Object. $..Date T o access the Methods of Primary Object using the Absolute Path : Example : $(Ledger, “Cash”). Opening Balance 5. Collection Capabilities Having understood the concept of Objects, Collection, Methods a nd Object association, let us now concentrate on understanding the concept of Collection as a Data Processing Artefact in TDL. In previous sections, we saw that a Collection can contain obje cts from T ally Database or populate objects from external data sources as well. In further sections, we will discuss the capabilities of collection from the data processing perspective. Let's segregate the capabilities into: Basic Capabilities Union Filtering Sorting Searching Advanced Capabilities Extraction Aggregation Usage As T ables Integration Capabilities using HTTP XML Collection Dynamic Object Support Collection Capabilities for Remoting We will be covering the Basic capabilities in detail with all t he relevant attributes and functions for achieving the same. Some portions of Advanced capab ilities which were available pr ior to T ally. ERP 9 will be covered here. The latest developments pertaining to this, will be covered in our training program 'TDL Enhancements for T ally. ERP 9'. 5. 1 Basic Capabilities Union 'Union' refers to creation of a Collection by combining multipl e Collections. The total number of objects in the resultant Collection will be the sum of objects in all the Collections. The following figure shows a Collection of sub-collections, which can further be unions of collections, and so on. | TDL_Reference_Manual.pdf |
Objects and Collections 81 Figure 6. 5 Collection of Sub-collection This example shows that Collection C1 contains Collection C2 an d Collection C3. Likewise, Collection C2 further contains Collection C4 and Collection C5. The attribute Collection is used to create a Union as follows: Attribute-Collection The attribute 'Collection' is used to specify a Collection unde r the main Collection. All the objects belonging to the Sub collections are available in the resultant Collection. Syntax Collection : <List of Collections> Where, <List of Collections> is a comma-separated list of collections. The Collections that are used can be of different types. Example : [Collection : Groupandledger] Collections : Group, Ledger Here, the collections 'Group' and 'Ledger' are used, under the main collection Groupand Ledger. Filtering If it is required to retrieve only a specific set of objects fr om a Collection, then the collection needs to be filtered. Filtering is applied on the Collection, based o n a condition. All the objects which satisfy the given condition are retrieved and are available in the Collection. Filtering Attributes The attributes used for applying a filter are Child Of, Belongs T o and Filter. | TDL_Reference_Manual.pdf |
Objects and Collections 82 Attribute-Child Of The Child Of attribute helps to control the display of the conte nts of a collection. It retrieves only those objects whose direct parent is the string specified as th e parameter of this attribute. Syntax Child Of : <String Formula> Example : [Collection : My Collection] Type : Ledger Child Of : "Sundry Debtors" It will return all the ledgers grouped directly under the group 'Sundry Debtors'. The following definition code w ill return all the ledgers under the group blank. By default, T ally returns the ledger 'Profit and Loss'. Child Of : "" Attribute-Belongs T o The attribute 'Belongs T o' is used along with the 'Child Of' at tribute. This attribute determines whether to retrieve the first level of objects under the value specified in 'Child Of', or include all the objects upto the lowermost level. 'Belongs T o' takes a logical value. Syntax Belongs To : <Logical Value> Where, <Logical Value> can be either YES or NO. Example : Consider the previous example of accounts. The following code i s an extension of that code. ' [Collection : My Collection] Type : Ledger Child Of : "Sundry Debtors" Belongs To : Yes This code will retrieve all the objects directly under the grou p 'Sundry Debtors', as well as all the objects which are under the sub groups of 'Sundry Debtors'. Attribute-Filter The attribute 'Filter' is used to specify the condition for fil tering the objects. The 'Filter' attribute takes a system formula. The condition is specified in the formula. If more than one filter has to be specified, they can be separated by comma. | TDL_Reference_Manual.pdf |
Objects and Collections 83 Syntax Filter : <Filter Name> Where, <Filter Name> is the name of the Global formula. Example : [Collection : Ltd Debtors] Type : Ledgers Child Of : “Sundry Debtors” Filter : Name Filter [System : Formula] Name Filter : $Name contains "Ltd" OR $Name contains "Limited" The filter Namefilter is used to fetch only those objects, whose name contains the st ring “Ltd” or “Limited”. Filtering Functions Function-$$Filter Amt Total It is used to get the sum of values returned by the specified f ilter expression, when applied to all the Objects in the Collection that satisfy the expression. The value returned is of type Amount. Syntax $$Filter Amt Total:<Collection Name>:<Filter Expression>:<Value Expression> Where, <Collection Name> is the name of a Collection, <Filter Expression> is a System Formula. <Filter Expression> is evaluated for each Object. The resultant Objects that clear the filter are selected for further processing. <Value Expression> is any valid expression, which is to be evaluated on each Objec t of the Collection. Example : $$Filter Amt Total : All Ledger Entries : Cash Bank Entries : $Amount [System : Formula] Cash Bank Entries : $$Is Cash Ledger : $Ledger Name AND $$Is Dr : $Amount The filter in the example checks whether the ledger is a Cash L edger and the amount is of the type 'Debit'. $$Is Cash Ledger is a logical Function, which checks whether the argument passed is a Cash Ledger or not. This statement can be evaluated only in t he context of a Voucher Object. | TDL_Reference_Manual.pdf |
Objects and Collections 84 Function-$$Filter Qty Total It is similar to $$Filter Amt T otal, except that the V alue Expres sion should evaluate to type Quantity. Syntax $$Filter Qty Total:<Collection Name>:<Filter Expression>:<Value Expression> Where, <Collection Name> is the name of Collection <Filter Expression> is a System Formula. The Filter Expression is evaluated for each Object, and the resultant Objects that clear the filter are selected for fu rther processing. <Value Expression> is any valid expression, which is to be evaluated on each Objec t of the Collection. Function-$$Filter Count The function $$Filter Count is used to get the total number of O bjects in a Collection, after the filters are applied. Syntax $$Filter Count : <Collection Name> : <Filter Expression> Where, <Collection Name> is the name of a Collection. <Filter Expression> is a System Formula. Example : $$Filter Count : All Ledger Entries:Has Bank Entry > 0 [System : Formula] Has Bank Entry : ($$Is Dr:$Amount != $Is Deemed Positive:+ Voucher Type:$Voucher Type Name)+ AND($$Is Led Of Grp:$Ledger Name:$$Group Bank+ OR $$Is Led Of Grp:$Ledger Name:$$Group Bank OD) It confirms whether the voucher has any Ledger under the Group Bank or Bank OD. $$Is Led Of Grp accepts two parameters and returns TRUE if paramet er 1 is a ledger of a Group mentioned in parameter 2. Group B ank OD and Group Bank are functio ns which return the name of the reserved groups Bank OD and Bank. Function-$$Filter Value This function is used to get the value of a specific expression, based on the position specified in the set of objects filtered by the expression. | TDL_Reference_Manual.pdf |
Objects and Collections 85 Syntax $$Filter Value : <Value Expression> : <Collection Name> : + <Position Specifier> : <Filter Expression> Where, <Collection Name> is the name of the Collection. <Filter Expression> is the filter applied to get a set of filtered Objects. <Position Specifier> denotes the position. <Value Expression> is any valid expression to be evaluated on each Object of the C ollection. Example : $$Filter Value : $Ledger Name:Ledger Entries : First:Is Party Ledger This example filters all the objects within Ledger Entries to sa tisfy the filter condition Is Party Ledger and returns the first value of the requested method Ledger Name that satisfies the condition. Some other Functions Used Function-$$Group Sundry Debtors It returns the name of the group 'Sundry Debtor', even if the u ser renames it. Syntax $$Group Sundry Debtors Example : [Collection : Sample Coll] Type : Ledgers Child Of : $$Group Sundry Debtors This will populate the collection Sample Coll with all objects under the Group 'Sundry Debtors'. In case the user has renamed the group “Sundry Debtors” as “My Sundry Debtors”, the following code snippet won't have any objects in the collection. [Collection : Sample Coll1] Type : Ledgers Child Of : “Sundry Debtors” But in this case, $$Group Sundry Debtors will populate the collection with all the objects that are under the Group 'Sundry Debtor' even if the user renames the gr oup. Function-$$Group Sundry Creditors It returns the name of the group 'Sundry Creditors', even if th e user renames it. Syntax $$Group Sundry Creditors | TDL_Reference_Manual.pdf |
Objects and Collections 86 Example : [Collection : Sample Coll] Type : Ledgers Child Of : $$Group Sundry Creditors This will populate the collection Sample Coll with all objects under the Group 'Sundry Creditors'. In case the user has renamed the group “Sundry Debtor” as “My S undry Debtors”, the following code snippet won't have any objects in the collection. [Collection : Sample Coll1] Type : Ledgers Child Of : “Sundry Creditors” But in this case, $$Group Sundry Creditor will populate the colle ction with all the objects that are under the Group “Sundry Creditors”, even if the user renames th e group. Sorting Sorting refers to the arrangement of objects in a specific orde r within the collection. The ordering is done on the basis of a specific method and the sort order can either be ascending or descending. The attribute Sort is used for this purpose. Attribute-Sort A collection can be sorted by specifying the sort sequence usin g the 'Sort' attribute. The collection can be sorted by a combination of fields in ascending as well a s in descending order. Syntax Sort : < Sort Name> : <List of Methods> Where, <List Of Methods> Is a comma separated list of methods. Sorting is done based on values of methods. The default sort order is ascending. Prefix Methods na me with '-', for descending order. Example : [Collection : My Collection] Collections : My Ledger Sort : Default : $Closing Balance, $Name Searching Collection capabilities have been enhanced to enable the indexi ng of objects based on a particular method. Whenever a collection is indexed on a particular method, it allows instant access to the corresponding values without the need for a complete scan. | TDL_Reference_Manual.pdf |
Objects and Collections 87 Attribute-Search Key Syntax Search Key : < Combination of Method name/s> This implies that a unique key is created for every object whic h can be used to instantly access the corresponding objects and its values. The function which is used to retrieve the values from a collec tion based on the key specified is $$Collection Field By Key. Function-$$Collection Field By Key Syntax $$Collection Field By Key : <Method Name> : <Key Formula> : <Collection Name> Where,<Method Name > is the name of the method. <Key Formula> is a formula that can be mapped to the methods defined in the s earch key exactly in the same order. Example : [Collection : My Ledgers] Type : Ledger Search Key : $Name [Field : My Closing Bal Field] Set as : $$Collection Field By Key:$Closing Balance:@My Search Key:+ My Ledgers My Search Key : #Led Name Here, a search key is defined on $name for collection My Ledgers. In the Field, value $Closing Balance is retrieved based on ledger name. In this case, retrie val is faster than ordinary retrieval. This capability is quite useful in case of matrix reports, i. e., when two or more dimensions need to be represented as rows and columns. In such a case, defining th e search key on a method combination, and using $$Collect ion Field By Key for value retriev al improves performance. The usage and examples based on the explanation above will be covered in detail in our training program “TDL Enhancements for T ally. ERP 9”. 5. 2 Advanced Capabilities Extraction and Chaining The Collection capabilities have been enhanced to extract infor mation from the collection using other collections, including its sub-objects, with the choice o f method(s), filter(s) and sort-order. Specific attributes have been added at the collection level to achieve the same. Prior to T ally. ERP 9, extraction was possible using specific fu nction $$Collection Field. | TDL_Reference_Manual.pdf |
Objects and Collections 88 Function-$$Collection Field This is used to get the value of a specified expression as appl ied on the nth Object of a Collection. Syntax $$Collection Field:<Value Expression>:<Position Number>:<Collection Name> Where, <Collection Name> is the name of a collection. <Value Expression> is any valid expression to be evaluated on the element at posit ion <Position Number> in the collection. Example : $$Collection Field : $Amount : 1 : All Ledger Entries It returns the first value of the Method Amount from All Ledger Entries Object. This function affects the performance of the report in terms of time taken to display the report. A detailed discussion on the enhancements for extraction, chainin g and reuse will be covered in the training program “TDL Enhancements for T ally. ERP 9. ” Grouping & Aggregation A major technological advancement in this release of T ally. ERP 9 is “Data Roll up in TDL Collection-GROUP BY”, which is a part of the TDL language cap abilities. This is a milestone achievement over the past 10 years. This will now facilitate th e creation of large summary tables of aggregations in a single shot, using the new attributes of the Collection description. This allows us to Walk down the object hierarchies and gather values to summarizes them in one scan. Overall, it reduces the TDL code complexity, resource requirement and increases performance drastically in case of reports generated using this new capability. The attributes used for extraction, chaining, and aggregation a nd grouping are Walk, By, Fetch, Compute, Aggr Compute. A detailed discussion on enhancements for aggregation and Grou ping using the new attributes will be covered in training program “T DL Enhancements for T ally. ERP 9. ” Prior to T ally. ERP 9, the totals were generated using the T otal and aggregation functions like Coll Amt T otal or Filter Amt T otal on collections. These have certain advantages and disadvantages. While they provide excellent granularity and control, each call is largely an independent activity to gather the data set and then aggregate it. This significantly affects the performance of the reports. Let us now discuss the various f unctions which are available fo r summarization and aggregation. Function-$$Coll Amt Total This function is used to get the sum of values of Type Amount returned by a specified expression when applied to all Objects in a given Collection. The return v alue is of type Amount. Syntax $$Coll Amt Total : <Collection Name> : <Value Expression> Where, <Collection Name> is the name of a Collection. <Value Expression> is any valid TDL expression to be evaluated on each Object of C ollection. | TDL_Reference_Manual.pdf |
Objects and Collections 89 Example : $$Coll Amt Total : Ledger Entries : $Amount It gets the sum of values in the Method Amount after it is applied on each Object in the Collection Ledger Entries. This statement will hold good only when one is in the context of V oucher Object. Function-$$Coll Qty Total This function is used to get the sum of values of Type Quantity returned by the specified expression when applied to all Objects in a given Collection. T he value returned is of Type Quantity. Syntax $$Coll Qty Total : <Collection Name> : <Value Expression> Where, <Collection Name> is the name of a Collection <Value Expression> is any valid TDL expression to be evaluated on each Object of C ollection. Example : $$Coll Qty Total : Inventory Entries : $Billed Qty Each Inventory entry in the current V oucher Object is picked up and the Method Billed Qty is evaluated on it. The resultant quantity is summed up to get the result. Function-$$Coll Num Total This function is used to get the sum of values of Type Number returned by the specified expression, when applied to all Objects in a given Collection. The value returned is of the Type Number. Syntax $$Coll Num Total : <Collection Name> : <Value Expression> Where, <Collection Name> is the name of a Collection. <Value Expression> is any valid expression to be evaluated on each Object of the C ollection. Example : $$Coll Num Total : Inventory Entries : $Height Each Inventory entry in the current Voucher Object is picked up and the Method Height evaluated on it. The resultant height is summed up to get the result. Her e, Height is an external Method of Object Inventory Entry in a Voucher. Usage as T ables TDL allows to display the values obtained from the collection a s a pop-up table. Earlier, the values of voucher and the ODBC data couldn't be displayed as a collect ion. Now, all limitations pertaining to usage of Collections as T ables have been completely eliminat ed. Any collection which can be created in TDL, can be displayed as a table now. Collection with aggregation and XML Collections can also be used as T ables. | TDL_Reference_Manual.pdf |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
Use the Edit dataset card button to edit it.
- Downloads last month
- 31