1. cmyk
WORKSHOP | TDL
Part III - Deeper into TDL
In this Part III article author explained about core objects, basic elements and
customizing the Reports using TDL.
Techknow Grid
for both Database Management as well as User Interface Design. In short,
Language TDL everything in Tally is an Object that is subdivided into 2 broad categories,
viz., Data Objects and Interface Objects.
Platform WIndows
Data Objects are Objects which holds data pertaining to various
Level Intermediate objects like Company, Group, Ledger, Stock Group, Stock Item, Units,
Voucher and many more. The core structure of all these objects is
predefined and can be further extended by the TDL Programmer.
— Sunil Gupta As the name suggests, Interface Objects are Objects that are
responsible for designing the user interface. While we invoke Tally.ERP 9
Application, following Interface Objects can be observed:
I
n Part II, we touched upon the flexibility of database architecture Menu Company Info is the initial Interface Screen if no Company
and a basic TDL program displaying Welcome to the World of is loaded.
TDL. On clicking on Menu Item Select Company, a Report querying for
In this Part, we will understand the core objects in TDL, basic Directory path and Company Name to be selected is displayed.
elements of TDL Program and steps to go about designing or List of existing Company Names being displayed in the Field
customizing the Reports. With this Part, we will be able to understand Company Name is a Table.
the simplicity of this programmer friendly language TDL. On selecting a Company, the Buttons like Select Company, Shut
Company, Date, Period, etc. are available at the right hand corner.
Core objects in Tally Every Interface Object is associated with the corresponding Data
Tally is a programming language which follows Object oriented approach Object using Object association mechanisms.
64 DeveloperIQ
cmyk
2. cmyk
WORKSHOP | TDL
Basically in TDL, specific definitions are provided to design the Line uses a Field
user Interface. A Menu is created by adding items to it, while a A Line can further use the list of required Fields.
Report is created using its components Form, Part, Line and Field.
TDL operates through the concept of an action which is to be A Field is where the contents are displayed or entered
performed and Definition on which the action is performed. A Field is the final element in the Report hierarchy which
contains the input or output value to be displayed or stored
Report/Form structure – elements respectively.
Anything that is edited, displayed, printed, emailed, exported in
TDL is a Report. It can be either printing an invoice, displaying a Customising a Report
Report or accepting inputs from the user. A Report is a basic TDL Example 1:
element consisting of various components like Form, Part, Line and Let’s take an example of customizing a new Report displaying the list
Field. A Report can have multiple Form, Part, Line and Field of Ledgers with their Telephone Numbers and Date of Birth that has
definitions but at least one visible definition of each type must be already been added to the ledger master in the Part I discussed
available. The hierarchy of these definitions is as follows: earlier.
Report uses a Form ;; Altering the default Menu Gateway of Tally
Report, which is the fundamental definition of TDL, is used to to add a new Item
design each and every input/output screen
displayed/printed/emailed in Tally. A Report in TDL can use one [#Menu: Gateway of Tally]
or more Form. Add : Item : Ledgers with DOB : Display :
Ledger List with DOB
Form uses a Part
A Form, being the layout of the desired Report can be further [Report: Ledger List with DOB]
divided into one or more parts vertically. Form : Ledger List with DOB
Part uses a Part or a Line [Form: Ledger List with DOB]
A Part can be further subdivided into various Parts either Use : DSP Template
horizontally or vertically or it can finally zoom down to the Parts : Form SubTitle, Ledger List with DOB
required Lines. ;; Using Default Part Form SubTitle for
Inserting a Title Line
DeveloperIQ 65
cmyk
3. cmyk
WORKSHOP | TDL
;; Locally modifying the Title to suit our Use : Name Field
current Report Information ;; Name Field is a Template defined in Default
Local : Field : Form SubTitle : Info : TDL for Fields of Type String with predefined
“List of Ledgers with their Birth Dates” Width
Set As : $Name ;; Default Method Name
[Part: Ledger List with DOB] used to set Name
Lines : LL with DOB Title, LL with DOB
;; The Line LL with DOB is instructed to repeat [Field: LL Tel]
over all Ledgers Use : Name Field
Repeat : LL with DOB : Ledger Set As : $LedgerPhone ;; Default Method
;; Associating the Object Ledger with Line LL Ledger Phone used to set Phone
with DOB such that every line will be Border : Thin Left
associated with
;; subsequent ledger in the Collection Ledger [Field: LL Email]
Scroll : Vertical Use : Name Field
Common Border : Yes Set As : $EMail ;; Default Method EMail
used to set Ledger Email
[Line: LL with DOB Title] Border : Thin Left
Use : LL with DOB
Border : Thin Top Bottom [Field: LL State]
Local: Field : Default : Type : String Use : Name Field
Local: Field : Default : Align: Centre Set As : $StateName + “-” + $PinCode
Border : Thin Left
;; Locally setting values to individual Fields
within this Line [Field: LL DOB]
Local: Field: LL Name: Set As: “Name” Use : Uni Date Field
Local: Field: LL Tel : Set As: “Contact No.” ;; Uni Date Field is a Template defined in
Local: Field: LL Email: Set As: “EMail ID” Default TDL for Fields of Type Date with
Local: Field: LL State : Set As: “State with predefined Width
Pin” Set As : $BirthDate
Local: Field: LL DOB : Set As: “Birth Date” Border : Thin Left
[Line: LL with DOB] The above TDL does the following:-
Fields : LL Name, LL Tel, LL Email, LL State
Right Fields: LL DOB Adds a new Item Ledgers with DOB in the Menu Gateway of Tally.
;; All the Lines where Value for the UDF Birth On drilling into this Item, the Report Ledger List with DOB is
Date is empty, Empty the lines displayed as shown below:
Empty : $$IsEmpty:$BirthDate
;; Value of any User Defined Fields/Methods can In the above code, Object Ledger is associated at Line and while
be retrieved using $ Prefix. repeating every line, subsequent Ledger Object within the
Collection Ledger is associated till the last Object. (See Fig. 1)
[Field: LL Name]
Fig 1: Customised a new Report
66 DeveloperIQ
cmyk
4. cmyk
WORKSHOP | TDL
Fig. 2 : Customised an existing Report Group Summary
With just about a few lines of TDL Code, we have achieved a [Field: Cust Grp Summ DOB]
Report displaying all the required information from the Ledger Use : Uni Date Field
Master. Set As : $BirthDate:Ledger:$Name
WYSIWYG i.e., What you see is what you get which means the Color : DOB Color ;; Color DOB Color used
same report which is displayed can also be printed, emailed, here defined below
exported to Excel file, etc.
[Color: DOB Color] ;; New Color Definition
Customising an existing Report with RGB Specification
Let’s examine the scenario of a Report already available in Tally by RGB : 50, 100, 70
default and user would require some minor changes to it.
The above code when implemented results in following output:
Example 2: (see Fig. 2) Similarly, we can also alter various reports that are used
Let’s take up an example of a default Group Summary where list of only in Print Mode like for e.g., an Invoice.
Parties are displayed with their respective Amounts (Opening
Balances, Transactions and Closing Balances). Consider, displaying Example 3:
the Date of Birth field next to the Party Name. Let’s take another example of an Invoice Printing where if the
In order to customize an existing Report, following simple steps current Date (Machine Date) is the customer’s date of birth, then a
are recommended: greeting message is printed in the Invoice.
Identify an existing Form, Part, Line or a Field in the Default
TDL where any change is desired. ;; Defining System Formulae
Alter the same to add new Parts, Lines, Fields, etc.
[System: Formula]
;; Existing Field DSP AccName altered to add ;; Formula IsBirthDay compares the Date and
new Field for Date of Birth Month of Machine Date with that of Party Master
IsBirthDay : $$DayOfDate:$$MachineDate =
[#Field: DSP AccName] ;; Field defined in $$DayOfDate:@@PartyBDInLedger AND +
Default TDL used in displaying Group Summary
Add Fields : Cust Grp Summ DOB $$MonthOfDate:$$MachineDate =
$$MonthOfDate:@@PartyBDInLedger
Fig. 2 PartyBDInLedger :
$BirthDate:Ledger:$PartyLedgerName
;; An existing Part EXPSMP Party is altered to
print Party’s Date of Birth
[#Part: EXPSMP Party]
Add : Lines : Inv DOB BirthDate
[Line: Inv DOB BirthDate]
Fields : Simple Field, Inv DOB BirthDate
Local : Field: Simple Field : Info :“Birth Date:”
DeveloperIQ 67
cmyk
5. cmyk
WORKSHOP | TDL
The following Simple Printed Invoice displays the customized and
[Field: Inv DOB BirthDate] additional Lines/Parts. Changes indicated in Red are the newly added
Use : Uni Date Field ones.
;; Symbol ‘@@’ is used to extract the value
from a system formula Conclusion
Set As : @@PartyBDInLedger The accompanying CD contains the latest free evaluation versions of
Tally.ERP 9 (Series A, Release 1.8) and Tally.Developer 9 (Release
;; An existing Form printing Simple Invoice is 1.1). Do please test drive these.
altered to add a new part printing Birthday
greetings Happy programming!
DIQ
[#Form: Simple Printed Invoice]
Add : Parts : After : EXPSMP Party : Inv DOB About Author
Greetings Author is working as Associate Vice President at Tally.
You can be contacted on his email id
[Part: Inv DOB Greetings] sunil.gupta@tallysolutions.com
Lines : Inv DOB Greetings
[Line: Inv DOB Greetings]
Delay LTE and
Fields : Inv DOB Greetings
Space Top: 1 upgrade 3G to save
;; This Line is made invisible if System
Formula IsBirthDay returns False (Today is not
his birthday)
cost: Aircom
Invisible : NOT @@IsBirthDay nstead of investing in new LTE technology, mobile telecom
I operators can save two thirds of their costs in the near future by
upgrading older 3G networks, telecoms consultancy Aircom said.
[Field: Inv DOB Greetings]
Aircom said a $750 million (520 million pounds) investment
Use : Name Field
was needed in the first 12 months for a British operator to start
FullWidth: Yes LTE roll-out, while upgrading a current network to new, so-called
Set As:“WISH YOU MANY MORE HAPPY RETURNS OF THE DAY” HSPA Plus technology can cost just $250 million as it is only new
Style : Inv DOB Big software.
Also Read: Yota plans $100mn for LTE network roll out
Align : Centre
"It will take less time and less capex to solve the problem in the
short term for any operator," Fabricio Martinez, head of the
;; Style Definition to specify font attributes services business at Aircom, told Reuters.
like Height, Bold, Italics, etc. TeliaSonera opened the first LTE network late last year in
Sweden and Norway, but many other mobile operators have only
slowly started to invest in the new technology, which promises to
[Style: Inv DOB Big] ease data overload in many networks.
Font : “Times New Roman” With prices of new equipment falling fast, the same LTE gear
Height : 13 is expected to be significantly cheaper in 12 or 24 months.
"We are seeing operators delay their LTE plans now, and we
Bold : Yes
expect this trend to continue," Martinez said.
Italics : No The delays are set to help current leaders of the mobile
telecom equipment industry -- Ericsson, Nokia Siemens and
Huawei -- and hurt gear vendors such as Alcatel-Lucent and
Motorola, which have bet heavily on a boom in LTE networks.
From the above code, the Simple Printed Invoice contains "The more operators delay, the more likely the incumbent
An additional line to an existing part EXPSMP Party i.e., viz., vendors are to secure longer-term business through HSPA+ and
Date of Birth. then on to LTE," Martinez said.
An additional Part in Form Simple Printed Invoice after Part Aircom reviewed investment needs for large operators in the
U.S., large Western European markets, the Middle East and in
EXPSMP Party to display greetings if current date is the Asia.
birth day.
68 DeveloperIQ
cmyk