Search:

Home | Computer | Software


Creating Masters in Tally using TDL: Part 1

By: Rajeev Singh

This article teaches how you can create masters in Tally using TDL (Tally definition Language). In the next Part [i.e Part 2] of this article, we shall focus on the ‘Alternate methods for Creating Masters’ and ‘Pros & Cons of creating masters using TDL’.

We all know what “masters” are. And if you are a programmer, you would certainly know what all it is required for creating masters viz Forms, Tables, Coding and all that stuff. Isn’t it? Before we start with TDL programming, let us see how do we create a Master in a Visual programming language like Visual basic or Delphi.

When you think of “Creating Masters”, certain things immediately come to mind:-
· Designing the Table structure
· Creating a form with the Visual interface
· Accepting and validating User-input
· Functionality to retrieve and store records in the database

And of-course, you need to follow the principles of Good programming. Before proceeding with the real task, let us understand the basic TDL fundamentals which are the building blocks for TDL programming.

Objects
******
The default TDL comprises of several pre-defined objects viz. Group, Ledger, Godown, Unit, Stock Group, Stock Item, Voucher, Voucher Types, Cost Centre, Cost Category, Budget etc.

You can think of Objects as a ‘Collection of fields that hold data’ which is like Tables or DBFs. In simple words, Objects hold data in form of records and a record is a collection of fields. TDL allows you to add new fields to the pre-defined Objects using UDFs.

User-defined Fields (UDFs)
**********************
TDL allows you to define UDFs which can hold persistent data. UDFs can be of various types viz String, Amount, Number, Date etc. UDFs may further be classified as follows:-

a) Single UDF
Allows you to input a single value. For example, you can add a new field (say Excise Registration Number) to the Ledger master entry screen.

b) Repeat UDF
Allows you to input multiple values. For example, you can add a new field (say Discount Amount) in the ITEMs section of the Sales or Purchase Voucher entry. In this case, the user is prompted to enter Discount Amount for each item/row.

c) Aggregate UDF
It is a collection of fields which repeats itself. In simple words, Aggregate UDF is a set of fields of different types and sizes that allows you to hold records of data.

Syntax for declaring Aggregate UDF
*****************************************
[System: UDF]
:Aggregate: :

Example
**********
[System: UDF]
MyDB: Aggregate: 1000
ChequeNo: String: 1000
ChequeDate: Date: 1001
BankName: String: 1002

On examining the UDF definitions given above, one question that immediately comes to mind is “How do we attach an UDF to a specific object ?”. Indeed, no Object has been specified in the above definitions.

Then, how do we do it? As mentioned earlier, UDFs are fields which can be added to any existing Object.

In our blogspot tdlplayground, we have already created some UDFs viz.
a) UDF for “Cheque no” in the Ledger Master entry screen
b) UDF for “Salesman” in the Voucher entry screen.
(Please visit tdlplayground for more information).

But, did we specify the Object to which the UDF is to be linked ? No, we did not specify any such object. Ooops…, then how does the UDF get attached to an Object and to which Object does it get attached? Here’s the Answer: In fact, it is not required to specify the Object as the UDF get automatically attached to the current Object. In simple words, a UDF used in the Ledger Master entry screen automatically gets attached to the Ledger Object. A UDF used in the Voucher entry screen automatically gets attached to the Voucher Object.That’s all.

More on Aggregate UDFs

An UDF is a single field, but for creating masters we require a table-like structure that can hold records. For this, Aggregate UDFs are to be used.

The Aggregate UDF can be created only under the Company Object. In simple words, the Company object is the only object that allows you to store tables (or Aggregate UDFs).

Download the TCP complied file and the source-code for Salesman Master from www.rtslink.com/images/tdl24.zip
View the complete article at our website. For more information, visit www.RTSlink.com/TallyCreatingMastersPart1.htm

Some Important facts
· For each Company in Tally, there is a single instance of the Company Object.
· To add a Aggregate UDF (which can reside only in the Company Object) , we have to ALTER the Company Object.
· You should not use CREATE action on the company object to add new Aggregate UDFs.

Article Source: http://www.yourarticle.info

Please Rate this Article

 

Not yet Rated

Click the XML Icon Above to Receive Software Articles Via RSS!

Monthly Niche Search

Powered by Article Dashboard