Download Free Tools for Tally ERP
FREE utilities for Tally Accounting Software

Saturday, December 15, 2007

Salesman UDF - User defined field

TDL24.zip which creates a Salesman field had been put-up on this blog-site long back. As there have been some queries relating to this TDL recently, we are providing some more details about it :-

TDL24.zip contains the following files:-
a) tdl24.txt (TDL Source-code for Tally 7.2)
b) tdl24.tcp (Compiled TDL code for Tally 7.2)

c) tdl9v24.txt (TDL Source-code for Tally 9)
d) tdl9v24.tcp (Compiled TDL code for Tally 9)

Though most of the code for tdl24.txt and tdl9v24.txt is same, the main difference is given below:-

Tally 9 TDL code

[#Part: CMP AccFeat Left]
.... rest of the code

Tally 7.2 TDL code

[#Part: CMP Advanced Features]
.... rest of the code

For Tally 9 users
How to enable Salesman UDF and input master-records ?

a) In the Gateway of Tally, press F11 to change FEATURES.
b) Next, select option "Accounting features"
c) Next, set the option "Enable Salesman" to Yes and input the Salesman records.

After enabling the Salesman UDF feature, you shall be able to view/input the Salesman Name in the SALES voucher entry screen.

For Tally 7.2 users
How to enable Salesman UDF and input master-records ?

a) In the Gateway of Tally, press F11 to change FEATURES.
b) Next, set the option "Set/modify other Company features" to Yes
c) Next, set the option "Enable Salesman" to Yes and input the Salesman records.

After enabling the Salesman UDF feature, you shall be able to view/input the Salesman Name in the SALES voucher entry screen.

Download the TDL24.ZIP file

Thursday, October 18, 2007

Using the $$FilterValue function

$$FilterValue Function

Syntax :

$$FilterValue : ValueExpression : CollectionName : PositionSpecifier : FilterExpression

Remarks:-
1) The $$FilterValue function allows you to apply a filter (FilterExpression) on a specified Collection (CollectionName), and
2) Get the first or the last Object (PositionSpecifier) of that filtered list and
3) Retrieve the value of any field/method (ValueExpression) of the first or last object as specified by PositionSpecifier.

Monday, September 3, 2007

Example 45: Using the $$Table function to lookup values in a Table

This program illustrates how to use the $$TABLE function to lookup records in a Table.

Herein, we shall create a Collection of STOCK ITEM's having two fields viz. Item-Name and Part-number. When the user selects an ITEM from the list, it's Part-Number must be automatically displayed.

Download TDL45
;;Program  :- TDL45.TXT
;;Author :- Shweta Computers
;;Objective:- Using $$Table to lookup/fetch field values



[#Menu: Gateway of Tally]
Item: TDL45 : Alter: My ItemReport



[Report: My ItemReport]
Form: My ItemForm



[Form: My ItemForm]
Part: My ItemPart



[Part: My ItemPart]
Line: My Line1, Myline2



[Line: My Line1]
Fields: Short Prompt, My ItemName
Local: Field: Short prompt: Set as: "Item Name:- "



[Line: My Line2]
Fields: Short Prompt, My ItemPartNo
Local: Field: Short prompt: Set as: "Part Number:- "



[Field: My ItemName]
Use: Name Field



;;Variable to hold the user-input
Modifies: varItemName



;;Specify the Collection Name
Table: My ItemList



Show Table: Always



[Field: My ItemPartNo]
Use: Name Field



;;Variable to hold the user-input
Modifies: varItemPartNo



Set as: $$Table:MyItemName:$PartNo



;;Required to assign value automatically on selection of ItemName
Set Always: Yes



[System: Variables]
varItemName: ""
varItemPartNo: ""



[Variable: varItemName]
Type: String



[Variable: varItemPartNo]
Type: String



[Collection: My ItemList]
Title: "Item List"
ListName : $$SysName:EndOfList
Objects: Item1,Item2,Item3,Item4,Item5



[Object: Item1]
Name: "Bush"
PartNo: "1001"



[Object: Item2]
Name: "Piston"
PartNo: "1002"



[Object: Item3]
Name: "Gear Box"
PartNo: "1003"



[Object: Item4]
Name: "O-Ring"
PartNo: "1004"



[Object: Item5]
Name: "Camshaft"
PartNo: "1005"
Notes:-
1) $$Table function accepts two arguments. 
Syntax:-
$$Table : <LookupExpr> : <LookupField>

Herein, the $$Table function searches for <LookupExpr> and returns the value for field <LookupField>.

Wednesday, August 29, 2007

Tally Software TDL functions

The following Tally Software TDL functions have been now included / covered :-

$$MonthOfDate
$$MonthStart
$$MonthEnd
$$SystemPeriodFrom
$$SystemPeriodTo
$$YearOfDate
$$YearEnd

Refer www.rtslink.com

Monday, August 27, 2007

Recycle bin for Tally Software with Source code

Recycle bin is a FREE add-on utility for Tally Software.

It enables you to retrieve Voucher entries that you may have accidentally deleted in Tally Software. It is similar to the Windows recycle-bin and works with Tally 7.2 and Tally 9.

Supports Tally 7.2 and Tally 9 Software.

View/Download the Recycle bin TCP Source-code.

Friday, August 24, 2007

Example 44: Adding FILTER button to MyDaybook

This program TDL44.TXT is an extension to my earlier program TDL43.TXT. It adds the FILTER button to My Daybook Report.

There are few minor modifications done to acheive the task:-
a) Add FILTER button to the FORM
b) Add few variables at the REPORT definition level

Download TDL44

The new code has been shown as highlighted.
;; PROGRAM: TDL44.TXT
;; AUTHOR : Shweta Computers
;;
;; Objective:- Adding Filter button to MyDaybook
;;======================================================================



;;Global Formula. Used to assign a simple text string to a Global constant.
[System: Formula]
MYDBKTDL: $LocaleString:"Daybook"



;;Add a new menu-item to the Gateway of Tally
[#Menu: Gateway of Tally]
Item: @@MYDBKTDL : Display: My DBKTDL



;;Control whether the menu-option is displayed or not?
Control: @@MYDBKTDL: $Allow:Display:Daybook



;; Syntax for $Allow
;; $Allow : <mode> : <family report name>
;; Return Value : Logical



[Report: MYDBKTDL]



Family: $Translate:"Daybook"
;; The attribute FAMILY specifies that this Report (i.e. MYDBKTDL)
;; belongs to a Family (report) named Daybook.
;; DAYBOOK is a pre-defined report and here we are specifying that
;; MYDBKTDL report belongs to the same DAYBOOK family.
;; This will affect ACCESS to MYDBKTDL report.
;; Now, when we change the ACCESS to DAYBOOK report using option
;; "Gateway of Tally -> Alt+F3 -> Security Features".
;; it will automatically affect the report MYDBKTDL



Title: $LocaleString:"Daybook"
Form : My Form



;;Variables used in the Report
Variables: SVFromDate,SVToDate,SVSortMethod
Variables: ExplodeFlag, ExplodeNarrFlag
Variables: OnlyAccVouchers,OnlyInvVouchers



Set: SV SortMethod : @@Default
Set: SVFromDate: $$MonthStart:##SVCurrentDate
Set: SVToDate: $$MonthEnd:##SVCurrentDate



;;Required for F12 Configuration
Repeat: SVColumntype, SVColumnName



;;PRINTSET affects the variables related to Printing, whereas
;;SET is used to assign values to variables used otherwise.
PrintSet: ReportTitle: $LocaleString:"Daybook"
PrintSet: PrintFileName: "Daybook"



[Form: My Form]



;;Pre-defined button. Adds the Print button
Button: PrintButton



;;EXPLODEFLAG is a pre-defined button in Default Tally.
;;Try using KEY instead of BUTTON, Alt+F1 still works,
;;but the "Alt+F1" button is not displayed
Button: ExplodeFlag



;;Pre-defined button. Required for F12 configuration
Button: DYBKConfigure



;;Pre-defined button. Filter records using Alt+F12 key
Button: FilterButton



Space Top : if $$InPrintMode then ##SVSpaceTop else 0.05 inches
Space Bottom: if $$InPrintMode then 0.5 else 0.05 inches
Space Left : if $$InPrintMode then 0.5 else 0.05 inches
Space Right : if $$InPrintMode then 0.25 else 0.05 inches



Part: My DB Title,My DB Body



[Part: My DB Title]



;;Optional Parts
Option: My DB PrntTitle : $$InPrintMode
Option: My DB ScrTitle : NOT $$InPrintMode



[!Part: My DB PrntTitle]



;;This is a pre-defined part in default TDL
Use: DSP AccTitles



[!Part: My DB ScrTitle]
Line: My DB Title



[Line: My DB Title]
Field : Name Field
Local : Field : Name Field : Set as : $$LocaleString:"Daybook"



[Part: My DB Body]
Line: My Line
Scroll: Vertical
Common Border: Yes
Repeat : My Line: My Collection



[Line: My Line]
Left Fields: Myfld1,MyFld2
Right Fields: MyFld3,MyFld4



;;This Shows the Ledger details when Alt+F1 key is pressed
Explode: MyExplodePart : ##ExplodeFlag



[Field: Myfld1]
;;TYPE attribute specifies the data-type of the field
Type : Date
Set as : $Date



[Field: Myfld2]
Use : Name Field
Set as : $$CollectionField:$LedgerName:1:AllLedgerEntries



[Field: Myfld3]
Use : Short Name Field
Set as : $VoucherTypeName



[Field: Myfld4]
Use : Amount Field
Set as : $Amount



;;Important:-
;;This PART is displayed when EXPLODEFLAG variable is set to Yes
;;i.e. When user presses Alt+F1 key
[Part: MyExplodePart]
Line : MyExplodline
Line : MyExplodeNarrLine



;;Repeats the line MyExplodeLine to display the AllLedgerEntries
;;Collection fields
Repeat : MyExplodline : AllLedgerEntries



;; Specify the fields that you wish to display when the PART is Exploded
[Line: MyExplodline]

;;Show this field on the left side of the line
Add: Left Fields: fldExplodeLedger,fldExplodeAmount



;;This skips the first object of Collection AllLedgerEntries
Empty: $$IsFirstObj



;;Ledger Name field
[Field: fldExplodeLedger]
Indent : 10
Use : Name Field
Set as : $LedgerName
Style : Small Italic
Width : @@NameWidth



;;Amount field
[Field: fldExplodeAmount]
Use : Amount Field
Set as : $Amount
Style : Small Italic
Width : @@ShortWidth



;; Line to Display Narration
[Line: MyExplodeNarrline]
Add: Left Fields: fldExplodeNarration



;;Display Narration field
[Field: fldExplodeNarration]
Indent : 12
Use : Name Field
Set as : $Narration
Style : Small Italic
Width : @@NameWidth



;;Collection definition
[Collection: My Collection]
Type: Voucher

Notes:-
1) This program is an extension of program TDL43.TXT
2) Herein, we have added Filter button to the MyDaybook Report.
To Filter records, press Alt+F12

Tuesday, August 21, 2007

TDL functions for Tally Software

The following TDL functions have been now included / covered :-

$$Upper
$$String
$$StringLength
$$StringPart
$$StringRemWord
$$StringWord

Refer www.rtslink.com

Monday, August 20, 2007

Example 43: Adding Narration line and F12 key functionality to My Daybook

This program TDL43.TXT is an extension to my earlier program TDL42.TXT. It adds the following functionality to the program TDL42.TXT (i.e. My Daybook Report)

a) Display the Narration line
b) Add F12 Configuration button

Please note that pressing F12 key displays the Configuration screen that contains several options. This programs addresses only the Narration option (and Condensed/Detailed) in the Configuration screen.

Download TDL43

The new code has been shown as highlighted.
;; PROGRAM: TDL43.TXT
;; AUTHOR : Shweta Computers
;;
;;Objective:-
;;To display Narration line and provide F12 Configuration key functionality
;;in My Daybook
;;======================================================================



;;Global Formula. Used to assign a simple text string to a Global constant.
[System: Formula]
MYDBKTDL: $LocaleString:"Daybook"



;;Add a new menu-item to the Gateway of Tally
[#Menu: Gateway of Tally]
Item: @@MYDBKTDL : Display: My DBKTDL



;;Control whether the menu-option is displayed or not?
Control: @@MYDBKTDL: $Allow:Display:Daybook



;; Syntax for $Allow
;; $Allow : :
;; Return Value : Logical



[Report: MYDBKTDL]



Family: $Translate:"Daybook"
;; The attribute FAMILY specifies that this Report (i.e. MYDBKTDL)
;; belongs to a Family (report) named Daybook.
;; DAYBOOK is a pre-defined report and here we are specifying that
;; MYDBKTDL report belongs to the same DAYBOOK family.
;; This will affect ACCESS to MYDBKTDL report.
;; Now, when we change the ACCESS to DAYBOOK report using option
;; "Gateway of Tally -> Alt+F3 -> Security Features".
;; it will automatically affect the report MYDBKTDL



Form : My Form



;;Title of the Report
Title: $LocaleString:"Daybook"



;;This variable is used in the current Report
Variables: ExplodeFlag, ExplodeNarrFlag



;;Required for F12 Configuration
Set : IsDaybook: Yes
Repeat: SVColumntype, SVColumnName



;;PRINTSET affects the variables related to Printing, whereas
;;SET is used to assign values to variables used otherwise.
PrintSet: ReportTitle: $LocaleString:"Daybook"
PrintSet: PrintFileName: "Daybook"



[Form: My Form]



Button: PrintButton
;;PrintButton is a pre-defined button. We just add is here.



Button: ExplodeFlag
;;EXPLODEFLAG is a pre-defined button in Default Tally.
;;Try using KEY instead of BUTTON, Alt+F1 still works,
;;but the "Alt+F1" button is not displayed



;;Required for F12 configuration
Button: DYBKConfigure



Space Top : if $InPrintMode then ##SVSpaceTop else 0.05 inches
Space Bottom: if $InPrintMode then 0.5 else 0.05 inches
Space Left : if $InPrintMode then 0.5 else 0.05 inches
Space Right : if $InPrintMode then 0.25 else 0.05 inches



Part: My DB Title,My DB Body



[Part: My DB Title]



;;Optional Parts
Option: My DB PrntTitle : $InPrintMode
Option: My DB ScrTitle : NOT $InPrintMode



[!Part: My DB PrntTitle]



Use: DSP AccTitles
;;This is a pre-defined part in default TDL



[!Part: My DB ScrTitle]
Line: My DB Title



[Line: My DB Title]
Field : Name Field
Local : Field : Name Field : Set as : $LocaleString:"Daybook"



[Part: My DB Body]
Line: My Line



Repeat : My Line: My Collection
;;Syntax:-
;;Repeat : :



Scroll: Vertical



;;Shows border
Common Border: Yes



[Line: My Line]
Left Fields: Myfld1,MyFld2
Right Fields: MyFld3,MyFld4



;;This Shows the Ledger details when Alt+F1 key is pressed
Explode: MyExplodePart : ##ExplodeFlag



[Field: Myfld1]
;;TYPE attribute specifies the data-type of the field
Type : Date
Set as : $Date



[Field: Myfld2]
Use : Name Field
Set as : $CollectionField:$LedgerName:1:AllLedgerEntries



[Field: Myfld3]
Use : Short Name Field
Set as : $VoucherTypeName



[Field: Myfld4]
Use : Amount Field
Set as : $Amount



;;Important:-
;;This PART is displayed when EXPLODEFLAG variable is set to Yes
;;i.e. When user presses Alt+F1 key
[Part: MyExplodePart]
Line : MyExplodline
Line : MyExplodeNarrLine



;;Repeats the line MyExplodeLine to display the AllLedgerEntries
;;Collection fields
Repeat : MyExplodline : AllLedgerEntries



;; Specify the fields that you wish to display when the PART is Exploded
[Line: MyExplodline]

;;Show this field on the left side of the line
Add: Left Fields: fldExplodeLedger,fldExplodeAmount



;;This skips the first object of Collection AllLedgerEntries
Empty: $IsFirstObj



;;Ledger Name field
[Field: fldExplodeLedger]
Indent : 10
Use : Name Field
Set as : $LedgerName
Style : Small Italic
Width : @@NameWidth



;;Amount field
[Field: fldExplodeAmount]
Use : Amount Field
Set as : $Amount
Style : Small Italic
Width : @@ShortWidth



;; Line to Display Narration
[Line: MyExplodeNarrline]
Add: Left Fields: fldExplodeNarration



;;Display Narration field
[Field: fldExplodeNarration]
Indent : 12
Use : Name Field
Set as : $Narration
Style : Small Italic
Width : @@NameWidth



;;Collection definition
[Collection: My Collection]
Type: Voucher

Notes:-
1) This program is an extension of program TDL42.TXT
2) We have added functionality to display the Narration line
3) We have added functionality for F12 Configuration key

TDL functions for Tally Software

The following TDL functions have been now included / covered :-

$$Alias
$$Allow
$$SerialNumber
$$SelectedCmps
$$SysName

Refer www.rtslink.com

Saturday, August 18, 2007

TDL Functions

The following TDL functions have been now included / covered :-

$$Abs
$$Max
$$Min
$$Round
$$RoundDown
$$RoundUp
$$ZeroFill

Refer www.rtslink.com

Thursday, August 16, 2007

TDL Functions

The following TDL functions have been now included / covered :-

$$LocaleString
$$InPrintMode
$$IsFirstObject
$$Value
$$IsEmpty

Refer www.rtslink.com

Wednesday, August 15, 2007

Example 40: Accessing fields of an Object

This post illustrates how to access fields (i.e. Internal methods) of "Ledger" object. You can similary access other objects also.

Download TDL40
;; PRODUCT: TDL40.TXT
;; AUTHOR: Shweta Computers

;;Objective:-
;;Accessing fields (Internal Methods) of an Object
;;======================================================================

;;Add a new menu-item to the Gateway of Tally
[#Menu: Gateway of Tally]

;;The ACTION used here is DISPLAY
Item: Example 40: Display: My Report

[Report: My Report]
Form : My Form
Title: $$LocaleString:"Accessing Fields of an Object"

[Form: My Form]
Part: My Part

[Part: My Part]
Line: My Line1,My Line2

;;Shows border
Common Border: Yes

[Line: My Line1]
Left Fields: Short Prompt,Myfld1
Local: Field: Short Prompt : Set as : "Ledger Balance"

[Line: My Line2]
Left Fields: Short Prompt,Myfld2
Local: Field: Short Prompt : Set as : "Group Name"

[Field: Myfld1]
Use : Name Field
Set as : $ClosingBalance:Ledger:"Cash"

[Field: Myfld2]
Use : Name Field
Set as : $Parent:Ledger:"Cash"

NOTES:
1) Accessing fields of an Object
Syntax:-
<FieldName> : <Object> : <Filter Value>

Example:-
$Closingbalance : Ledger : "Cash"

Explanation:
a) $Closingbalance is a field of Object LEDGER. It is also called Internal Method
b) The 2nd parameter is the LEDGER Object
c) The 3rd parameter is the LEDGER Name ("Cash") whose field
value is to be retrieved.

2) Short Prompt is a pre-defined field. Herein, we are using LOCAL attribute
to modify the definition of the field Short Prompt which is effective only
in this Report.

Example 42: Adding Access-control functionality to menu-options

This post illustrates how to add Access-control functionality to menu-option MyDBKTDL (MyDaybook). This program (i.e TDL42) is an extension to our earlier program TDL41.

To understand this program, you must enable the Security features in your Company. It is advised to try out this program in a Dummy Company.

Steps enable Security Control:-
1) Open any Company (say Dummy)
2) Press Alt+F3 in the "Gateway of Tally" menu. This will bring forth "Company Info" screen.
3) Select option "Alter" and select the Company Name.
4) In the "Company Alteration" screen, set "Security Control" to YES and enter the ADMIN-name and password. Save the Company details.

Steps to Create new User:-
1) Press Alt+F3 in the "Gateway of Tally" menu and then select "Security Control" option.
2)Next, select option "Users and passwords" to create a user. Enter any Username (say ABC) and password and then set the "Security Level" to DATA ENTRY.

Steps to Assign rights to the new User:-
1) Press Alt+F3 in the "Gateway of Tally" menu and then select "Security Control" option.
2)Next, select option "Types of Security" and then disallow access to Report DAYBOOK to the User that you have created.

Summary
In the above mentioned steps, we have
a) Enabled "Security Control" in the Company Alteration screen
b) Created a new user.
c) Disallowed Access-rights to DAYBOOK report to the new User (ABC).

As you can see, we have restricted the newly created USER from Accessing the DAYBOOK Report. Now, in program TDL42, we create a new report MYDBKTDL which belongs to the DAYBOOK family. As a result, the ACCESS-CONTROL for DAYBOOK applies to MYDBKTDL also.

Download TDL42

;; PROGRAM: TDL42.TXT
;; AUTHOR : Shweta Computers

;;Objective:-
;;Allow/Disallow Access-control to Menu option that we have added in
;;Gateway of Tally
;;======================================================================

;;Global Formula. Used to assign a simple text string to a Global constant.
[System: Formula]
MYDBKTDL: $$LocaleString:"Daybook"

;;Add a new menu-item to the Gateway of Tally
[#Menu: Gateway of Tally]
Item: @@MYDBKTDL : Display: My DBKTDL

;;Control whether the menu-option is displayed or not?
Control: @@MYDBKTDL: $$Allow:Display:Daybook

;; Syntax for $$Allow
;; $$Allow : <mode> : <family report="" name="">
;; Return Value : Logical

[Report: MYDBKTDL]

Family: $$Translate:"Daybook"
;; The attribute FAMILY specifies that this Report (i.e. MYDBKTDL)
;; belongs to a Family (report) named Daybook.
;; DAYBOOK is a pre-defined report and here we are specifying that
;; MYDBKTDL report belongs to the same DAYBOOK family.
;; This will affect ACCESS to MYDBKTDL report.
;; Now, when we change the ACCESS to DAYBOOK report using option
;; "Gateway of Tally -> Alt+F3 -> Security Features".
;; it will automatically affect the report MYDBKTDL

Form : My Form

;;Title of the Report
Title: $$LocaleString:"Daybook"

;;This variable is used in the current Report
Variables: ExplodeFlag

;;PRINTSET affects the variables related to Printing, whereas
;;SET is used to assign values to variables used otherwise.
PrintSet: ReportTitle: $$LocaleString:"Daybook"
PrintSet: PrintFileName: "Daybook"

[Form: My Form]

Buttons: PrintButton
;;PrintButton is a pre-defined button. We just add is here.

Space Top : if $$InPrintMode then ##SVSpaceTop else 0.05 inches
Space Bottom: if $$InPrintMode then 0.5 else 0.05 inches
Space Left : if $$InPrintMode then 0.5 else 0.05 inches
Space Right : if $$InPrintMode then 0.25 else 0.05 inches

Part: My DB Title,My DB Body

Button: ExplodeFlag
;;EXPLODEFLAG is a pre-defined button in Default Tally.
;;Try using KEY instead of BUTTON, Alt+F1 still works,
;;but the "Alt+F1" button is not displayed

[Part: My DB Title]

;;Optional Parts
Option: My DB PrntTitle : $$InPrintMode
Option: My DB ScrTitle : NOT $$InPrintMode

[!Part: My DB PrntTitle]

Use: DSP AccTitles
;;This is a pre-defined part in default TDL

[!Part: My DB ScrTitle]
Line: My DB Title

[Line: My DB Title]
Field : Name Field
Local : Field : Name Field : Set as : $$LocaleString:"Daybook"

[Part: My DB Body]
Line: My Line

Repeat : My Line: My Collection
;;Syntax:-
;;Repeat : <line> : <Collection>

Scroll: Vertical

;;Shows border
Common Border: Yes

[Line: My Line]
Left Fields: Myfld1,MyFld2
Right Fields: MyFld3,MyFld4

;;This Shows the Ledger details when Alt+F1 key is pressed
Explode: MyExplodePart : ##ExplodeFlag

[Field: Myfld1]
;;TYPE attribute specifies the data-type of the field
Type : Date
Set as : $Date

[Field: Myfld2]
Use : Name Field
Set as : $$CollectionField:$LedgerName:1:AllLedgerEntries

[Field: Myfld3]
Use : Short Name Field
Set as : $VoucherTypeName

[Field: Myfld4]
Use : Amount Field
Set as : $Amount

;;Important:-
;;This PART is displayed when EXPLODEFLAG variable is set to Yes
;;i.e. When user presses Alt+F1 key
[Part: MyExplodePart]
Line : MyExplodline

;;Repeats the line MyExplodeLine to display the AllLedgerEntries
;;Collection fields
Repeat : MyExplodline : AllLedgerEntries

;; Specify the fields that you wish to display when the PART is Exploded
[Line: MyExplodline]

;;Show this field on the left side of the line
Add: Left Fields: fldExplodeLedger,fldExplodeAmount

;;This skips the first object of Collection AllLedgerEntries
Empty: $$IsFirstObj

;;Ledger Name field
[Field: fldExplodeLedger]
Indent : 10
Use : Name Field
Set as : IF NOT $$IsFirstObj then $LedgerName else ""
Style : Small Italic
Width : @@NameWidth

;;Amount field
[Field: fldExplodeAmount]
Use : Amount Field
Set as : $Amount
Style : Small Italic
Width : @@ShortWidth

;;Collection definition
[Collection: My Collection]
Type: Voucher

Notes:-
1) This program is an extension of program TDL41.TXT
2) ACCESS-CONTROL functionality is added to the menu-option MYDBKTDL using the $$Allow function.

Tuesday, August 14, 2007

Example 41: Adding Print functionality to MyDaybook

This post illustrates how to add Print functionality to the report MyDaybook. This program (i.e TDL41) is an extension to our earlier program TDL38.

Download TDL41

;; PRODUCT: TDL41.TXT
;; AUTHOR: Shweta Computers

;;Objective:-
;;Adding Print functionality to MyDaybook
;;======================================================================

;;Global Formula. Assign a text string to MYTDL41
[System: Formula]
MYTDL41: $$LocaleString:"Daybook"

;;Add a new menu-item to the Gateway of Tally
[#Menu: Gateway of Tally]

;;ACTION used here is DISPLAY
Item: @@MYTDL41 : Display: My Report

[Report: My Report]

Form : My Form
Title: $$LocaleString:"Daybook"
Variables: ExplodeFlag

;;This is used to set the variables which will affect Printing only.
PrintSet: ReportTitle: $$LocaleString:"Daybook"
PrintSet: PrintFileName: "Daybook"

[Form: My Form]

;;PrintButton is a pre-defined button. We are just adding it here.
;;This will display a PRINT button on the right-hand side of Tally screen.
Buttons: PrintButton

Space Top : if $$InPrintMode then ##SVSpaceTop else 0.05 inches
Space Bottom: if $$InPrintMode then 0.5 else 0.05 inches
Space Left : if $$InPrintMode then 0.5 else 0.05 inches
Space Right : if $$InPrintMode then 0.25 else 0.05 inches

Part: My DB Title,My DB Body

;;Pre-defined button in Default Tally. Try using KEY instead of BUTTON,
;;Alt+F1 still works, but the "Alt+F1" button is not displayed
Button: ExplodeFlag

[Part: My DB Title]
Option: My DB PrntTitle : $$InPrintMode
Option: My DB ScrTitle : NOT $$InPrintMode

[!Part: My DB PrntTitle]
Use: DSP AccTitles

[!Part: My DB ScrTitle]
Line: My DB Title

[Line: My DB Title]
Field : Name Field
Local : Field : Name Field : Set as : $$LocaleString:"Daybook"

[Part: My DB Body]
Line: My Line

Repeat : My Line: My Collection
;;Syntax:-
;;Repeat : :

Scroll: Vertical

;;Shows border
Common Border: Yes

[Line: My Line]
Left Fields: Myfld1,MyFld2
Right Fields: MyFld3,MyFld4

;;This Shows the Ledger details when Alt+F1 key is pressed
Explode: MyExplodePart : ##ExplodeFlag

[Field: Myfld1]
;;TYPE attribute specifies the data-type of the field
Type : Date
Set as : $Date

[Field: Myfld2]
Use : Name Field
Set as : $$CollectionField:$LedgerName:1:AllLedgerEntries

[Field: Myfld3]
Use : Short Name Field
Set as : $VoucherTypeName

[Field: Myfld4]
Use : Amount Field
Set as : $Amount

;;Important:-
;;This PART is displayed when EXPLODEFLAG variable is set to Yes
;;i.e. When user presses Alt+F1 key
[Part: MyExplodePart]
Line : MyExplodline

;;Repeats the line MyExplodeLine to display the AllLedgerEntries
;;Collection fields
Repeat : MyExplodline : AllLedgerEntries

;; Specify the fields that you wish to display when the PART is Exploded
[Line: MyExplodline]

;;Show this field on the left side of the line
Add: Left Fields: fldExplodeLedger,fldExplodeAmount

;;This skips the first object of Collection AllLedgerEntries
Empty: $$IsFirstObj

;;Ledger Name field
[Field: fldExplodeLedger]
Indent : 10
Use : Name Field
Set as : IF NOT $$IsFirstObj then $LedgerName else ""
Style : Small Italic
Width : @@NameWidth

;;Amount field
[Field: fldExplodeAmount]
Use : Amount Field
Set as : $Amount
Style : Small Italic
Width : @@ShortWidth

;;Collection definition
[Collection: My Collection]
Type: Voucher

Notes:
1) This program is a extension to program TDL38.TXT

2) This program adds a button called PrintButton which is a
pre-defined button. This will add the Printing functionality
in our Report.

3) We have defined OPTIONAL parts "My DB PrntTitle" and "My DB ScrTitle"
as we want to have different titles for Printing and Screen.

4) We have added SPACE(s) to our Form for formatting purpose.
Example:-
Space Bottom: if $$InPrintMode then 0.5 else 0.05 inches

5) $$InPrintMode is a Internal function that returns logical true
if the report is being printed.

Example 39: Accessing fields of Company Object

This post illustrates how to access fields (i.e. Internal methods) of "Company" object.

Download TDL39


;; PRODUCT: TDL39.TXT
;; PRODUCT-ID: de535cfa-1r7f-3h7a-31h3-a5r55a984e6e
;; AUTHOR: Shweta Computers

;;Objective:-
;;Accessing fields of Company Object
;;======================================================================

;;Add a new menu-item to the Gateway of Tally
[#Menu: Gateway of Tally]

;;The ACTION used here is DISPLAY
Item: Example 39: Display: My Report

[Report: My Report]
Form : My Form

[Form: My Form]
Part: My Part

[Part: My Part]
Line: My Line1,My Line2

;;Shows border
Common Border: Yes

[Line: My Line1]
Left Fields: Short Prompt,Myfld1
Local: Field: Short Prompt : Set as : "Company Number"

[Line: My Line2]
Left Fields: Short Prompt,Myfld2
Local: Field: Short Prompt : Set as : "Owner Name"

[Field: Myfld1]
Use : Short Name Field
Set as : $CompanyNumber:Company:##SVCurrentCompany

[Field: Myfld2]
Use : Short Name Field
Set as : $OwnerName:Company:##SVCurrentCompany

NOTES:

1) Accessing fields of Company Object
Syntax:-
: Company :

Example:-
$BooksFrom : Company : ##SVCurrentCompany

Explanation:
a) $BooksFrom is a field of Object Company. It is also called Internal Method
b) The 2nd parameter is the Company Object
c) The 3rd parameter is the Company Name (##SVCurrentCompany) whose field
value is to be retrieved.

2) Short Prompt is a pre-defined field. Herein, we are using LOCAL attribute
to modify the definition of the field Short Prompt which is effective only
in this Report.

Monday, August 13, 2007

Example 38: Using EXPLODE attribute to display Daybook in detailed format

This post illustrates how to use "EXPLODE" attribute at LINE-definition level.

TDL38 is an extension of program TDL30 in which we created a simple Daybook-style report. TDL38 adds new functionality to display the Daybook-report in Detailed format

Download TDL38

;;Objective:-
;;Using the EXPLODE attribute to display Ledgers details in
;;MY DAYBOOK format
;;======================================================================

;;Add a new menu-item to the Gateway of Tally
[#Menu: Gateway of Tally]

;;The ACTION used here is DISPLAY
Item: Example 38: Display: My Report

[Report: My Report]
Form : My Form

[Form: My Form]
Part: My Part

;;Pre-defined button in Default Tally. Try using KEY instead of BUTTON,
;;Alt+F1 still works, but the "Alt+F1" button is not displayed
Button: ExplodeFlag

[Part: My Part]
Line: My Line

Repeat : My Line: My Collection
;;Syntax:-
;;Repeat : <line> : <collection>

Scroll: Vertical

;;Shows border
Common Border: Yes

[Line: My Line]
Left Fields: Myfld1,MyFld2,MyFld3,MyFld4

;;This Shows the Ledger details when Alt+F1 key is pressed
Explode: MyExplodePart : (##ExplodeFlag or $$KeyExplode)

[Field: Myfld1]
;;TYPE attribute specifies the data-type of the field
Type : Date
Set as : $Date

[Field: Myfld2]
;;The USE keyword inherits the functionality/properties of the specified object
Use : Short Name Field
Set as : $VoucherTypeName

[Field: Myfld3]
Use : Name Field
Set as : $$CollectionField:$LedgerName:1:AllLedgerEntries

[Field: Myfld4]
Use : Amount Field
Set as : $Amount

;;Important:-
;;This PART is displayed when EXPLODEFLAG variable is set to Yes
;;i.e. When user presses Alt+F1 key
[Part: MyExplodePart]
Line : MyExplodline

;;Repeats the line MyExplodeLine to display the AllLedgerEntries
;;Collection fields
Repeat : MyExplodline : AllLedgerEntries

;; Specify the fields that you wish to display when the PART is Exploded
[Line: MyExplodline]

;;Show this field on the left side of the line
Add: Right Fields: fldExplodeLedger,fldExplodeAmount

;;This skips the first object of Collection AllLedgerEntries
Empty: $$IsFirstObj

;;Ledger Name field
[Field: fldExplodeLedger]
Use : Name Field
Set as : IF NOT $$IsFirstObj then $LedgerName else ""
Style : Small Italic
Width : @@NameWidth

;;Amount field
[Field: fldExplodeAmount]
Use : Amount Field
Set as : $Amount
Style : Small Italic
Width : @@ShortWidth

;;Collection definition
[Collection: My Collection]
Type: Voucher

Notes:-
1) EXPLODE attribute is used at LINE definition level to display (i.e explode)
additional details.

2) When the user presses Alt+F1 key, the ledger details are shown.

3) The attribute EMPTY is used at LINE definition level as shown below:-

Empty: $$IsFirstObj

Syntax:- Empty : <condition>
The EMPTY attribute is used at the LINE definition level to skip the line,
if the condition is true. Herein, we have specified that 1st Object of the
Collection "AllLedgerEntries" must be skipped.

4) $$IsFirstObj
Return value: Logical
Checks whether the object is the 1st object or not in the given collection

5) CollectionField is a Tally Internal Function. It returns the Method/Field
data of the specified Collection as applied on the "nth" object of the
Collection. In the above code, it fetches the 1st LedgerName from the
Collection "AllLedgerEntries".

Syntax: $$CollectionField: <method field=""> : <positionnumber> : <collection>
Return Value: Method/Field value as specified as the 1st argument

6) AllLedgerEntries is a pre-defined Collection that contains Ledger details
for the VOUCHER object. $LedgerName is a method/Field of this collection.

7) Date,VoucherTypeName,VoucherNumber,Amount are methods/fields of
VOUCHER object.

8) NameWidth, ShortWidth, Small Italic are pre-defined Global formulaes.

Saturday, August 11, 2007

Example 37: Using "Control" attribute at Menu definition level

This post illustrates how to use "Control" attribute at menu-definition level.

Download TDL37


;;Objective:-
;;Using "Control" attribute at Menu level
;;=========================================================================

;;Global formula definition
[System: Formula]
locSR : $$LocaleString:"Sales Register"
locPR : $$LocaleString:"Purchase Register"

;;Add a new menu-item to the Gateway of Tally
[#Menu:Gateway of Tally]
Item : Example 37: Menu : My Menu

[Menu: My Menu]

;;1st Menu option
Item: @@locSR : Display : Sales Register

;;2nd Menu option.
Item: @@locPR : Display : Purchase Register

Item: Blank
Key Item: @@locQuit

Control : @@locSR : ##ShowSR
Control : @@locPR : ##ShowPR

[System: Variable]
ShowSR : Yes

;;This will hide the 2nd menu-option
ShowPR : No

[Variable: ShowSR]
Type : Logical

[Variable: ShowPR]
Type : Logical

Notes:-
1) We are using ITEM to define menu-items rather than using KEY ITEM
This is because KEY ITEM is supported in only Tally 9, whereas
ITEM is supported in both Tally 7.2 and Tally 9

Friday, August 10, 2007

Example 36: Disabling menu-options in Tally 7.2

This post illustrates how to disable a menu-option in Tally 7.2.

Download TDL36


;;Objective:-
;;Disabling Menu options in Tally 7.2
;;=========================================================================

;;Global formula definition
[System: Formula]
locSR : $$LocaleString:"Sales Register"
locPR : $$LocaleString:"Purchase Register"

;;Add a new menu-item to the Gateway of Tally
[#Menu:Gateway of Tally]
Item : Example 35: Menu : My Menu

[Menu: My Menu]
;;1st Menu option
Item: @@locSR : Display : Sales Register : ##ShowSR

;;2nd Menu option
;;This option is disable as variable ShowPR is set to NO
Item: @@locPR : Display : Purchase Register : ##ShowPR

Item: Blank
Key Item: @@locQuit

[System: Variable]
ShowSR : Yes
ShowPR : No

[Variable: ShowSR]
Type : Logical

[Variable: ShowPR]
Type : Logical

Example 35: Disabling menu-options in Tally 9

This post illustrates how to disable a menu-option in Tally 9.

Download TDL35


;;Objective:-
;;Disabling Menu Options in Tally 9
;;=========================================================================

;;Global Formula
[System: Formula]
locSR : $$LocaleString:"Sales Register"
locPR : $$LocaleString:"Purchase Register"

;;Add a new menu-item to the Gateway of Tally
[#Menu:Gateway of Tally]
Item : Example 35: Menu : My Menu

[Menu: My Menu]
;;KEY ITEM works with Tally 9 only.
;;Refer TDL36.TXT for Tally 7.2
Key Item: @@locSR : S : Display : Sales Register : ##ShowSR
Key Item: @@locPR : P : Display : Purchase Register : ##ShowPR
Item: Blank
Key Item: @@locQuit : Q

[System: Variable]
ShowSR : Yes
ShowPR : No

[Variable: ShowSR]
Type : Logical

[Variable: ShowPR]
Type : Logical

Thursday, August 9, 2007

Example 34: Using Validate Attribute at FIELD definition level

This post illustrates how to use "Validate" Attribute at FIELD definition level.

Download TDL34


;;Objective:-
;;Using "Validate" attribute at FIELD definition level
;;=========================================================================

;; Add a new menu-item to the Gateway of Tally. Note that the Action is
;; ALTER (and not display)

[#Menu:Gateway of Tally]
Item : Example 34 : Alter : My Report

[Report: My Report]
Form: My Form

[Form: My Form]
Part: My Part

[Part: My Part]
Line: My Line

[Line: My Line]
Fields: My Field1

[Field: MyField1]
Use: Name Field

;;Validates that the Field Value must not be Empty.
;;Similar to the "Control" attribute but does not display any message
Validate : NOT $$IsEmpty:$$Value
Notes:-
1)
$IsEmpty checks whether the parameter passed is Empty or not.
Syntax: $$IsEmpty:
2) $$Value
Returns the value of the current field



Example 33: Using "Control" Attribute at FIELD definition level

This post illustrates how to use "Control" Attribute at FIELD definition level.

Download TDL33

;; PRODUCT: TDL33.TXT
;;=========================================================================
;; Add a new menu-item to the Gateway of Tally. Note that the Action is
;; ALTER (and not display as used generally)



[#Menu:Gateway of Tally]
Item : Example 33 : Alter : My Report



[Report: My Report]
Form: My Form



[Form: My Form]
Part: My Part



[Part: My Part]
Line: My Line



[Line: My Line]
Fields: My Field1



[Field: MyField1]
Use: Name Field



;;Display a message if the Field Value is Empty
Control : EmptyValueMsg : $$IsEmpty:$$Value



;;Global formula
[System: Formula]
EmptyValueMsg : $$LocaleString:"Cannot be empty.\nPlease enter some value."
Notes:-
1)
$$IsEmpty checks whether the parameter passed is Empty or not.
Syntax: $$IsEmpty:
2) $$Value
Returns the value of the current field
3) \n is used for line-feed

Wednesday, July 4, 2007

Exporting a user-defined Report

This post illustrates how to create a Report and Export it.

TDL32 displays a menu-option "Export Report" in the "Gateway of Tally ". On selecting this option it displays Vouchers details like Date, Ledger; VoucherType etc. You can now EXPORT this Report by pressing ALT+E key.

Download TDL32
;; PRODUCT: TDL32.TXT
;; PRODUCT-ID: dr334cfa-2r7f-3f7a-51h3-a3r54a994e6w
;; AUTHOR: Shweta Computers
;;=========================================================================

;;Add a new menu-item to the Gateway of Tally
[#Menu: Gateway of Tally]
Item: Report Export: Display: My Report

[Report: My Report]
Form : My Form

;;Export the Report
Export : Yes

[Form: My Form]

;;Displays the Export button. Use Alt+E to Export the Report.
Button: ExportButton

Part: My Part
Full Width: Yes
Full Height: Yes
XMLTag: ENVELOPE

[Part: My Part]
Line: My Line
Repeat : My Line: My Collection
Scroll: Vertical
Common Border: Yes
XMLTag: MyVoucher

[Line: My Line]
Left Fields: Myfld1,MyFld2,MyFld3,MyFld4

[Field: Myfld1]
;;TYPE attribute specifies the data-type of the field
Type: Date
Set as : $Date
XMLTag: Date

[Field: Myfld2]
;;The USE keyword inherits the functionality/properties of the specified object
Use : Short Name Field
Set as : $VoucherTypeName
XMLTag: VoucherType

[Field: Myfld3]
Use : Name Field
Set as : $$CollectionField:$LedgerName:1:AllLedgerEntries
XMLTag : LedgerName

[Field: Myfld4]
Use : Amount Field
Set as : $Amount
XMLTag : Amount

;;Collection definition
[Collection: My Collection]
Type: Voucher

Notes:-
1) Export attribute at the Report level makes the Report exportable.
2) XMLTag attribute is used to specify the XML-Tag-name for the Report fields.
3) ExportButton is a predefined button definition.
4) You can fetch the above Report data manually (using Alt+E) or programmatically using RTSlink DLL, like you fetch data of other pre-defined reports.

Passing parameters to TDL procedures

This post illustrates how to pass parameters to TDL procedures. TDL31 program retreives Payment Vouchers

Download TDL31
;; PRODUCT: TDL31.TXT
;; PRODUCT-ID: cr405yfa-3e7f-5d9a-52h6-acr80a55436e
;; AUTHOR: Shweta Computers
;;=========================================================================

;; Collection-name that begins with an underscore is a Procedure
[Collection: _MyVouchers]

;;Based on the Voucher Object
Type : Voucher

;;Requires ONe parameter i.e. VoucherType Name
SQLParms : pVchType

;;Data that is returned to the calling program
SQLValues : Voucher Date : $Date
SQLValues : Voucher Number : $VoucherNumber
SQLValues : Voucher Reference : $VoucherReference
SQLValues : Voucher Amount : $Amount
SQLValues : Voucher Type : $VoucherTypeName

;;Filters out the Collection for Object that match the given condition
Filters : MyVchTypeFilter


[System: Formula]
;;Used as Filter condition
MyVchTypeFilter : $VoucherTypeName = #pVchType

[Variable: pVchType]
Type: String

[System: Variable]
pVchType: ""

Notes:-
Procedures can be invoked using SQLRequest() function of RTSlink DLL
as given below:

Syntax:-
SQLRequest("Call _MyVouchers('Payment')")

Sunday, July 1, 2007

Creating Procedures in TDL

This post illustrates how to create Procedures in TDL.

TDL Procedures are different from the procedures/functions used in other programming languages. A TDL proceedure is basically a collection of SQL-Columns that is returned to the calling program.

To create a Procedure, you define a Collection that starts with an underscore. Next, SQLValues attribute defines the columns that you require to be returned to the calling program.

Download TDL29
;; PRODUCT: TDL29.TXT
;; PRODUCT-ID: dr205cfa-1e7f-3f9a-32h8-acr50a55436e
;; AUTHOR: Shweta Computers
;;=========================================================================

;; Procedures must begin with _ (underscore) in TDL
;; Procedures return data to the calling program
[Collection: _MyVouchers]
;;This collection is based on the pre-defined type Voucher
Type : Voucher

SQLValues : Voucher Date : $Date
SQLValues : Voucher Type : $VoucherTypeName
SQLValues : Voucher Number : $VoucherNumber
SQLValues : Voucher Reference : $VoucherReference
SQLValues : Voucher Amount : $Amount

Notes:-
1) SQLValues is an attribute that can be used with Collection
definition
2) SQLValues requires TWO parameters
1st Parameter : Column Name
2nd Parameter : Column Value (usually this is a Method/Field Name)

3) Procedures can be invoked using SQLRequest() function of RTSlink DLL
as given below:

Syntax:-
SQLRequest("Call _MyVouchers")

4) For more information on how to use the SQLRequest() function, refer link www.rtslink.com

Using $$FullList function

$$FullList is a Tally Internal Function. It fetches and returns the specified Method/Field values from the given Collection.
Syntax : $$FullList : <CollectionName> : <Method/FieldName>
Return Value : Method/Field type


The $$FullList function is basically used to fetch all the values for a specified Method/Field from a given Collection. For more information and sample program, refer article "Fetch Tally Voucher Data including Stock-Item details"

Using $$CollectionField Function

This post illustrates how to use the $$CollectionField Tally Internal Function.

Download program TDL30
;; PRODUCT: TDL30.TXT
;; PRODUCT-ID: br535cfa-1r7f-3h7a-31h3-a5r55a994e6w
;; AUTHOR: Shweta Computers
;;=========================================================================

;;Add a new menu-item to the Gateway of Tally
[#Menu: Gateway of Tally]
Item: CollectionField Example: Display: My Report

[Report: My Report]
Form : My Form

[Form: My Form]
Part: My Part
Full Width: Yes
Full Height: Yes

[Part: My Part]
Line: My Line
Repeat : My Line: My Collection
Scroll: Vertical
Common Border: Yes

[Line: My Line]
Left Fields: Myfld1,MyFld2,MyFld3,MyFld4

[Field: Myfld1]
;;TYPE attribute specifies the data-type of the field
Type: Date
Set as : $Date

[Field: Myfld2]
;;The USE keyword inherits the functionality/properties of the specified object
Use : Short Name Field
Set as : $VoucherTypeName

[Field: Myfld3]
Use : Name Field
Set as : $$CollectionField:$LedgerName:1:AllLedgerEntries

[Field: Myfld4]
Use : Amount Field
Set as : $Amount

;;Collection definition
[Collection: My Collection]
Type: Voucher
;; Notes:-
1) $$CollectionField is a Tally Internal Function. It returns the Method/Field
data of the specified Collection as applied on the "nth" object of the
Collection. In the above code, it fetches the 1st LedgerName from the
Collection "AllLedgerEntries".

Syntax: $$CollectionField: <Method/Field> : <PositionNumber> : <Collection>
Return Value: Method/Field value as specified as the 1st argument

2) AllLedgerEntries is a pre-defined Collection that contains Ledger details
for the VOUCHER object. $LedgerName is a method/Field of this collection.

3) Date,VoucherTypeName,VoucherNumber,Amount are methods/fields of
VOUCHER object.

Saturday, June 30, 2007

Report Inheritance : How to Create new Reports based on existing Reports?

Program TDL28 illustrates the concept of Report Inheritance. i.e. creating a new Report based on a existing Report. Download TDL28

;; PRODUCT: TDL28.TXT
;; PRODUCT-ID: cd205cfa-1d7f-4f9a-92h8-ace40a5943be
;; AUTHOR: Shweta Computers
;;=========================================================================

;;Modify the Gateway of Tally menu to add a new Menu item
[#Menu: Gateway of Tally]
Add: Item: My Daybook: Display: My Daybook

;;Report Definition
[Report: My Daybook]

;;This inherits the functionality of existing (pre-defined) Report
Use : Voucher Register

;;Change the default Period
Set : SVFROMDATE: $$DateFrom
Set : SVTODATE : $$DateTo

;; Notes:-
;; 1) $$DateFrom function returns the date from which the period begins
;; 2) $$DateTo function returns the date with which the period ends
;; 3) SVFROMDATE is a pre-defined Global variable
;; 4) SVToDATE is a pre-defined Global variable

Saturday, June 23, 2007

Voucher Statistics using $$IsPayment, $$IsReceipt etc

You can fetch Voucher statistics using $$IsPayment, $$IsReceipt and others similar functions. For more information on these TDL functions, refer www.rtslink.com

Syntax:-
$$IsPayment: <VoucherTypeName>

Return Value:
Logical

Download TDL27 program.

This TDL program creates a Collection/table which contains Voucher statistics data. To view the Collection data, you can use SQLRequest() function of RTSlink DLL. Refer, rtslink.blogspot.com for more information.
;; PRODUCT: TDL27
;; PRODUCT-ID: ad157cfa-2s7f-4g9a-52f8-ade40a2983be
;; AUTHOR: Shweta Computers
;;==========================================================================
;;This program defines a Collection called VCHStatistics.
;;This collection can be accessed using SQLRequest() function of RTSlink DLL
;;==========================================================================

;;****** Collection definition ******
;;VCHStatistics is a collection that contains a single Object (record) called MyObjects.
;;IsODBCTable is set as YES so that this collection is accessible to external programs

[Collection: VCHStatistics]
Object: MyObjects
IsODBCTable: Yes

;;******* Object Definition *********
;;Herein we are defining an Object called "MyObjects" which comprises of THREE fields
;;1st: PaymentVouchers - Number of Payment Vouchers
;;2nd: ReceiptVouchers - Number of Receipt Vouchers
;;3rd: AllVouchers - Total Number of Vouchers

;;The FilterCount function requires a Formula (i.e. condition) as the 3rd parameter.
[Object: MyObjects]
PaymentVouchers : $$FilterCount:RTSAllVouchers:HasPaymentVouchers
ReceiptVouchers : $$FilterCount:RTSAllVouchers:HasReceiptVouchers
AllVouchers : $$FilterCount:RTSAllVouchers:AlwaysTrue

;;******* Global Formula definition ********
;;$VoucherTypeName refers to the Field NAME of Voucher Collection

[System: Formula]
HasPaymentVouchers : $$IsPayment:$VoucherTypeName
HasReceiptVouchers : $$IsReceipt:$VoucherTypeName
AlwaysTrue : $$IsWindows


;;******* Collection Definition ********
;;This makes the pre-defined Voucher Collection accessible to external programs
;;and also to the user-defined collection VCHStatistics
;;
[Collection: RTSAllVouchers]
Type: Voucher
IsODBCTable: Yes

;;Notes
;;=====
;; $$IsPayment is a Tally Interenal Function that is used to check whether a Voucher is
;; Payment Voucher or not
;; Syntax :- $$IsPayment:
;; Return Value:- Logical
;;
;; $$IsReceipt is a Tally Interenal Function that is used to check whether the Voucher is
;; Receipt Voucher or not
;; Syntax :- $$IsReceipt:
;; Return Value:- Logical
;;
;; $$IsWindows is a Tally Internal Function which checks whether the OS is Windows or not.
;; Syntax :- $$IsWindows
;; Return Value:- Logical

Friday, June 22, 2007

Example 26: Using $$FilterCount function

FilterCount is a Tally (Internal) function that allows you to count records of a Collection/table based on a filter condition.

Syntax:-
$$FilterCount: <CollectionName> : <Condition>

Return Value:
Numeric

Download TDL26 program.

This TDL program creates a Collection/table which contains some statistics data. However, this data is not displayed directly in Tally. To view the Collection data, you can use SQLRequest() function of RTSlink DLL. Refer, rtslink.blogspot.com for more information.
;; PRODUCT: TDL26
;; PRODUCT-ID: cd387cfa-1d7f-4g9a-52f8-ace40a2983be
;; AUTHOR: Shweta Computers
;;==========================================================================
;;This program defines a Collection called MyStatistics.
;;This collection can be accessed using SQLRequest() function of RTSlink DLL
;;==========================================================================

;;****** Collection definition ******
;;MyStatistics is a collection that contains a single Object (record) called MyObjects.
;;IsODBCTable is set as YES so that this collection is accessible to external programs

[Collection: MyStatistics]
Object: MyObjects
IsODBCTable: Yes

;;******* Object Definition *********
;;Herein we are defining an Object called "MyObjects" which comprises of THREE fields
;;1st: DebtorsLedgers - Number of Ledgers falling under group Sundry Debtors
;;2nd: CreditorsLedgers - Number of Ledgers falling under group Sundry Creditors
;;3rd: AllLedgers - Total Number of Ledgers

;;The FilterCount function requires a Formula (i.e. condition) as the 3rd parameter.
;;which is defined below
[Object: MyObjects]
DebtorsLedgers : $$FilterCount:Ledger:HasSundryDebtors
CreditorsLedgers: $$FilterCount:Ledger:HasSundryCreditors
AllLedgers : $$FilterCount:Ledger:AlwaysTrue

;;******* Global Formula definition ********
;;$Name refers to the Field NAME of Ledger Collection

[System: Formula]
HasSundryDebtors : $$IsLedOfGrp:$Name:$$GroupSundryDebtors
HasSundryCreditors: $$IsLedOfGrp:$Name:$$GroupSundryCreditors
AlwaysTrue : $$IsWindows

;;Notes
;;=====
;; $$IsLedOfGroup is a Tally Interenal Function that is used to check whether a Ledger falls under a
;; specific Group or not.
;; Syntax :- $$IsLedOfGroup: <LedgerName>: <GroupName>
;; Return Value:- Logical
;;
;; $$IsWindows is a Tally Internal Function which checks whether the OS is Windows or not.
;; Syntax :- $$IsWindows
;; Return Value:- Logical
;;
;; $$GroupSundryDebtors is a Tally Internal Function
;; Syntax :- $$GroupSundryDebtors
;; Return Value:- String: The Group-Name for pre-defined Tally Group "Sundry Debtors"
;;
;; $$GroupSundryCreditors is a Tally Internal Function
;; Syntax :- $$GroupSundryCreditors
;; Return Value:- String: The Group-Name for pre-defined Tally Group "Sundry Creditors"

Monday, June 18, 2007

Example 25: Adding Voucher-Creation-Date/Time

This program TDL25 adds FOUR (invisible) fields to the Voucher entry screen. The fields are as follows:-
a) Voucher-Creation-Date
b) Voucher-Creation-Time
c) Voucher-Alteration-Date
d) Voucher-Alteration-Time

The basic idea of adding these fields is to keep track of "Vouchers that have been added or modified during a specific period ?"

Create a plain text file that contains the following Code. For those who have joined now, please note that you can use plain TXT files to customize Tally even without Tally Developer. For more information, refer post "How to Customize Tally Software using TXT files ?"

CODE
;; PRODUCT: 
;; PRODUCT-ID: cc307cfa-1d7f-4f9a-92f8-ace40a2943be
;; AUTHOR: Shweta Computers
;;=====================================================================

;;UDF's declaration. New fields declaration
;;=====================================================================
[System: UDF]
fldVCHCreationDate : Date : 1025
fldVCHCreationTime : String: 1026
fldVCHAlterationDate: Date : 1027
fldVCHAlterationTime: String: 1028

;;This will expose the newly added fields through Voucher Object so
;;that it can be accessed elsewhere
;;=====================================================================
[#Object: Voucher]
VCHCreationDate : $fldVCHCreationDate
VCHCreationTime : $fldVCHCreationTime
VCHAlterationDate: $fldVCHAlterationDate
VCHAlterationTime: $fldVCHAlterationTime

;;The Voucher Object is modified to include optional definitions
;;a) In case of Voucher Creation, the prtVchNarrationInCreateMode replaces
;; the existing VoucherNarration Part definition
;;b) In case of Voucher Altertion, the prtVchNarrationInAlterMode replaces
;; the existing VoucherNarration Part definition
;;=====================================================================
[#Part: VCH Narration]
Option: prtVCHNarrationInCreateMode : $$InCreateMode AND NOT $$InDuplicateMode
Option: prtVCHNarrationInAlterMode : $$InAlterMode OR $$InDuplicateMode

;;Optional Part definition
[!Part: prtVCHNarrationInCreateMode]
;; Local: Line : VCH NarrPrompt: Add: Fields: Short Prompt
;; Local: Field: Short Prompt : Set as: "Create mode: "
Add: Line: LnVCHNarrationInCreateMode

;;Line definition
[Line: lnVCHNarrationInCreateMode]
Add : Fields: VCHCreationDate
Add : Fields: VCHCreationTime

;;Optional Part definition
[!Part: prtVCHNarrationInAlterMode]
;; Local: Line : VCH NarrPrompt: Add: Fields: Short Prompt
;; Local: Field: Short Prompt : Set as: "Alter mode: "
Add: Line: LnVCHNarrationInAlterMode

;;Line definition
[Line: lnVCHNarrationInAlterMode]
Add : Fields: VCHAlterationDate
Add : Fields: VCHAlterationTime

;;Field definition for Voucher Creation Date
;;=====================================================================
[Field: VCHCreationDate]
Use: Short Date Field
Storage: fldVCHCreationDate
Set as: $$MachineDate
Set Always: Yes
;;Try changing Invisible to NO
Invisible: Yes

;;Field definition for Voucher Creation Time
;;=====================================================================
[Field: VCHCreationTime]
Use: Short Name Field
Storage: fldVCHCreationTime
Set as: $$MachineTime
Set Always: Yes
;;Try changing Invisible to NO
Invisible: Yes

;;Field definition for Voucher Alteration Date
;;=====================================================================
[Field: VCHAlterationDate]
Use: Short Date Field
Storage: fldVCHAlterationDate

;;This will forcefully store the $$MachineDate (i.e. CurrentDate in field)
Type: Date: Forced

Set as: $$MachineDate
Set Always: Yes

;;Try changing Invisible to NO
Invisible: Yes

;;Field definition for Voucher Alteration Time
;;=====================================================================
[Field: VCHAlterationTime]
Use: Short Name Field
Storage: fldVCHAlterationTime

;;This will forcefully store the $$MachineTime (i.e. CurrentTime in field)
Type: String: Forced

Set as: $$MachineTime
Set Always: Yes

;;Try changing Invisible to NO
Invisible: Yes
Download the TDL25 sample program.

Friday, June 15, 2007

TDL programs 16 to 20

TDL programs 16 to 20 have been re-checked/verified for Tally 9/Tally 7.2.

You can now use/or modify these programs even without having Tally Developer software.

For more information on using TXT files to customize Tally or to download these programs, visit "How to use TXT files to customize Tally Accounting Software"

Saturday, June 9, 2007

TDL programs 11 to 15

TDL programs 11 to 15 have been re-checked/verified for Tally 9/Tally 7.2.

You can now use/or modify these programs even without having Tally Developer software.

For more information on using TXT files to customize Tally or to download these programs, visit "How to use TXT files to customize Tally Accounting Software"

Friday, June 8, 2007

TDL programs 6 to 10

TDL programs 6 to 10 have been re-checked/verified for Tally 9/Tally 7.2.

You can now use/or modify these programs without having Tally Developer. For information or to download these programs, visit "How to use TXT files to customize Tally Accounting Software"

Thursday, June 7, 2007

How to Customize Tally Accounting Software using TXT files ?

Yes. You can customize Tally Accounting Software (Tally 7.2 / Tally 9) using TXT files. No need of Tally Developer for compiling files.

For more information visit How to customize Tally Accounting Software at www.rtslink.com

Friday, May 25, 2007

Tally 7.2 Release 1 - UDF's not working

Many of the sample programs that use UDFs (User-defined fields) do not work in Tally 7.2 Release 1 as there are bugs in Tally 7.2 Release 1.

This has been confirmed by Tally Solutions, Bangalore the email text is reproduced herewith:-

"This is with reference to your below email, regarding code is not working in Tally 7.2 Release 1

Please suggest the customer to upgrade the Tally 7.2 Release 3.13, if the customer is using hard lock then please suggest the customer to use Tally 7.2 Release 1.42

Please note : Some bugs which was there in Tally 7.2 Release 1 that's has been rectified in Tally 7.2 Release 1.42 to 3.13"

Monday, April 9, 2007

Correction in TDL9v24 file (for Tally 9)

Corrections have been made in the "Salesman Master" (i.e. tdl9v24.tcp for Tally 9) which are as follows:-

Tally 9 TDL code

[#Part: CMP AccFeat Left]
.... rest of the code


Tally 7.2 TDL code

[#Part: CMP Advanced Features]
.... rest of the code

Download the tdl9v24.tcp and tdl24.tcp file with source-code.

Tuesday, March 20, 2007

Saturday, March 17, 2007

Example 23: 'Discount Amount' field instead of 'Discount Percentage' in Sales entry

This program modifies the Sales Voucher entry screen to accept "Discount" in Amount instead of Percentage.

View the TDL source-code.
Download source-code (zip) file.

Thursday, March 15, 2007

Tally programmers group

Join the Tally programmers group and send in your questions/answers relating to Linking your software with Tally, Tally customization and Tally Definition Language (TDL).

Visit Yahoo Tally programmers Group

Sunday, March 11, 2007

Recycle-bin for Tally

Enables you to retrieve Voucher entries that you may have accidentally deleted in Tally. It is similar to the Windows recycle-bin and works with Tally 7.2 and Tally 9. The ZIP file contains a readme.txt file which contains steps for configuring Tally.ini in order to use RBIN.TCP file.

ZIP file contents
RBIN.TCP for Tally 7.2
RBIN9v.TCP for Tally 9
Readme.txt

Download Recycle-bin for Tally [Freeware]

Bugs fixed:
Recycle-bin now works using option "GatewayOfTally - Balance Sheet @Drill down to Voucher level and use Alt+D to delete any Voucher]

Friday, March 9, 2007

Example 22: Popup-list with pre-defined choices

This program shows how you can create a Popup-List with pre-defined choices.

View the TDL source-code.
Download source-code (zip) file.

Wednesday, March 7, 2007

Example 21: Add Cheque Number Field

This program adds a field 'ChequeNumber' in the Receipt & Payment Voucher entry screen.

Click here to download the Example 21 compiled file and the source-code.

Monday, March 5, 2007

Example 20: Single UDF Vs Repeat UDF

Earlier in Example 19, we have seen how to add a UDF (Single UDF) in the Ledger Master. Now, we shall see how to add a REPEAT UDF.

A Single UDF allows you to enter ONE value, whereas a Repeat UDF allows you to enter several/multiple VALUES.

Syntax:-
<FieldName> : <FieldType> : <Index> : <RepeatYesNo>

Example:-
[System: UDF]
MyRepeatUDF: String: 1000: Yes

Click here to download the Example 20 compiled file and the source-code.

Saturday, March 3, 2007

Example 19: Adding field in the Ledger Master

This TDL program adds a field (named MyField) in the Ledger Master. This new field appears in the section "Mailing and Related details" when you create Ledger under "Sundry Debtors" or "Sundry Creditors" group.

In case, if you require any other field in Ledger Master, you can send in you Queries to tdlplayground@rtslink.com.

Click here to download the Example 19 compiled file and the source-code.

Wednesday, February 28, 2007

Example 18: Trial Balance - A Top-to-Bottom view

This is a modified version of our earlier Trial Balance TDL program. It shows how you can use 'Collection' defintion and the 'ChildOf' attribute to display the Trial-balance with Top-to-bottom (drill-down) feature.

Click here to download the Example 18 compiled file and the source-code.

Monday, February 26, 2007

Example 17: Using Ledger Object to display Ledger help-list

This program shows how you can display Ledger Name and Closing balances in HELP facility in a your TDL forms.

;; Modify the "Gateway of Tally" menu and Add a new option "Ledger Help"
[#Menu: GatewayOfTally]



;;Please note that the actions used here is CREATE and not DISPLAY as
;;User-input has to be enabled
Add: Item : Ledger Help : Create : rptLedger



;;Report definition
[Report: rptLedger]
Form: frmLedger



;;Form definition
[Form: frmLedger]
Part: prtMyPart1
Width: 70% screen
Height: 50% screen



;;Part definition
[Part: prtMyPart1]
Line: lnMyLine1



;;Line definition
[Line: lnMyLine1]
;;Short Prompt is a field defined in default TDL. Hence, it is just added to this line
;;but is not defined in this TDL.
Fields: Short Prompt, fldLedgerName



;;Modifies the field 'Short Prompt' locally
Local: Field: Short Prompt: Set As: "Ledger Name:"



;;Field definition
[Field: fldLedgerName]



;;Inherit from the default TDL field 'Name Field'
Use: Name Field



;;Field type
Type: String



;;This displays the Ledger help-list in a Table format
Table: My Ledgers



;;Display the Help-list Table always
ShowTable: Always



;;Variable to hold user-input
Variable: varLedgerName



;;Define a Collection named 'My Ledgers' which is used in the 'fldLedgerName' field
;;definition wherein the Table attribute displays the Collection data.
[Collection: My Ledgers]



;;Collection is based on Internal Object LEDGER which is defined in default TDL
Type: Ledger



;;Specify the format/width of Columns required in Help-List
Format: $Name, 30
Format: $ClosingBalance,15



;;This will display Phone Number
;;Format: $LedgerPhone



;;Local Variable definiton
[Variable: varLedgerName]
Type: String

Click here to download the Example 17 compiled file and the source-code.

Corrections

1) TDL-0014 is now available for download.
2) Group Master (GROUP.ZIP) and Ledger Master (LEDGER.ZIP) files are now available for download from FTP site. Due to the large file-size (appx 2MB each), there was problem sending these files by email to certain email accounts. There shouldn't be any problems now as you can get it via FTP directly.

Saturday, February 24, 2007

Example 16: Fetch Address of Sundry Debtors/Creditors

This program displays the addresses of Ledgers created under "Sundry Debtors" and "Sundry Creditors" Group. It shows how you can retreive values of Internal Object/Table Ledger.

Click here to download the Example 16 compiled file and the source-code.

Friday, February 23, 2007

Example 15: Add Salesman field in "Sales Voucher" entry screen

Objective:-
Add a Salesman field in the default Voucher Entry screen. This field should appear
only when the Voucher type is Sales

    
;;User-defined field definition
[System: UDF]
;;Syntax: <Field>: <FieldType>: <Index>
;;<Index> can be any value between 1000 to 9000. It relates to the Index order
;;while arranging fields in a Report. This is not relevant at present, so we
;; shall use any value between 1000 to 9000.
Salesman: String: 1001



;;This Modifies the default Voucher Entry screen. You need to mention which part of
;;the Voucher entry screen is to be modified. "EI BaseInfo" is a Part defined
;;in the default Tally TDL
;;===================================================================================

[#Part: EI BaseInfo]



;; IF the VoucherType is Sales, then the Optional Part EI SALESMAN is activated
;; $$IsSales is an Internal Function defined in the default TDL
;; ##SVVoucherType is a Global Variable defined in the default TDL
;;=============================================================================
Option: EI Salesman: $$IsSales:##SVVoucherType



;;This is how we define the Optional Part.
[!Part: EI Salesman]
Add: Line: lnSalesman



[Line: lnSalesman]
Add: Field: lblSalesman
Add: Field: fldSalesman



;;This is the label (text)
[Field: lblSalesman]
Info: "Salesman: "
Width: 15



;;This is where the User will input the "Salesman"
[Field: fldSalesman]
Use: Short Name Field
Storage: Salesman
Width: 20

Click here to download the Example 15 compiled file and the source-code.

Thursday, February 22, 2007

Example 14: Colorful Trial Balance

Example 14 Illustrates how you can use the "Option" keyword to display different colors in our sample Trial Balance.

This example is an extension to Example 12a. It display Ledgers in RED color if the Ledger balance is greater than 1000.

Click here to download the Example 14 compiled file and the source-code.

Tuesday, February 20, 2007

Example 12a: Attributes ChildOf; BelongsTo; Filter

ChildOf attribute
The ChildOf attribute is used with Collections. It controls how the Collection is displayed. Example:-
[Collection: My Collection]
Type: Ledger
ChildOf: $$GroupSundryDebtors

The above TDL code returns all the Ledgers directly falling under Group "Sundry Debtors".

BelongsTo attribute
The BelongsTo attribute returns all the objects directly or indirectly falling under the specified Collection. Example:-
[Collection: My Collection]
Type: Ledger
ChildOf: $$GroupSundryDebtors
BelongsTo: Yes

The above TDL code returns all the Ledgers falling under Group "Sundry Debtors" and its sub-groups.

Filter attribute
The Filter attribute is used to set a filter on the Collection. Example:-
[Collection: My Collection]
Type: Ledger
ChildOf: $$GroupSundryDebtors
BelongsTo: Yes
Filter: MyFilter



[System: Formula]
MyFilter: $ClosingBalance > 0

The above TDL code returns all the Ledgers falling under Group "Sundry Debtors" and its sub-groups where the ClosingBalance is greater than Zero.

A TDL program illustrating the above attributes is given herewith for your reference. Click here to download the Example 12a compiled file and the source-code.

Monday, February 19, 2007

Example 12: More on Collections

This program creates a Collection of Objects which store Employee data viz (Name; Birthdate etc). It illustrates how you can use User-Defined-Collections and display the data in Report. Also uses TDL Internal date functions viz a) $$YearofDate b) $$ MonthofDate c) $$ DayofDate

Click here to download the Example 12 compiled file and the source-code.

Saturday, February 17, 2007

Example 11: Objects & Collections

OBJECTS
Objects in TDL are classified as Internal Objects and External Objects.

Internal Objects
There are several pre-defined Internal Objects in TDL viz. Company, Group, Ledger, Stock Group, Stock Item, Voucher, Voucher Type etc.

External Objects or User-defined Objects
You can define your own Objects in TDL. Example:-

[Object: Contact1]
Name: "Dinesh Shukla"
Email: abc@mycompany.com
Phone: "9987654321"



[Object: Contact2]
Name: "Aakash Choudhary"
Email: xyz@mycompany.com
Phone: "123456"

We shall be using Internal and External Objects quite frequently in the succeeding sections of this tutorial.

Collections
A Group of Objects is referred as a Collection. You can create a collection of the Objects as follows:-

[Collection: My Collection]
Object: Contact1
Object: Contact2

A Program illustrating the use of Objects and Collection is provided for your reference. Click here to download the Example 11 compiled file and the source-code.

Retrieving Value of Internal Objects & Internal Functions

Symbol '$'
The symbol '$' is used to retrieve the value of Internal Objects. For example, '$' can be used to fetch the ClosingBalance or Name field-value of the Internal Object LEDGER.

[Field: My Field]
Set as: $Name

Symbol '$$'
The symbol '$$' is used to retrieve the Function Values in TDL. For example, '$$' can be used to fetch the Date as shown below.

[Field: My Date]
Set as: $$MachineDate

There are several Internal functions in TDL which shall be discussed in the forth coming sessions.

Local and Global Formulae

A Formulae is like a macro used in other programming languages. It allows you to define a NAME for a value.

Local Formulae
[Field: My Field]
Set as: @Company
Company: "ABC PVT LTD"



In the above field definition, the "Set as" attribute is used to set the value of the field using a local formulae "Company" To access local formulae, "@" symbol is used.

Global Formulae
[System: Formula]
MyBackgroundColor: "Yellow"



[Field: MyField]
Set as: "www.tdlplayground.blogspot.com"
Background: @@MyBackgroundColor



When you require a formula in more than one fields, you need to create a Global formula. To access Global formula value, the symboll "@@" is used.

Thursday, February 15, 2007

Example 10: UDFs

You can add new fields in any Master entry screen or Voucher entry screen by creating UDFs (User-defined Fields). UDFs can be of type String, Number, Date, Logical, Amount, Quantity or Rate.



Syntax:-
[System: UDF]
<UDF Name>: <UDF Type>: <Index>: <Is Repeatable>



Example:-
[System: UDF]
MyUDF: String: 1000
Notes:-
1) UDFs are to be defined at the System level.
2) Each UDF must be given a Unique Name.
3) As Index number is to be provided for evey UDF which must be between 1 to 9999.
4) Is Repeatable specifies whether the UDF holds single or multiple values. By default, it is NO, meaning the UDF can store a single value only.

Example:- Adding a new field in the Ledger Master
;;UDF definition
[System: UDF]
MyUDF: String: 1000



;;Modify the Ledger Master entry screen and add a new line
[#Part: Led Other Details]
Add: Line: MyLine



[Line: My Line]
Field: Short Prompt,My Field
;;Display Text
Local: Field: Short Prompt: Set as: "UDF field: "



[Field: My Field]
Use: Short Name Field
Storage: MyUDF

Click here to download the Example 10 compiled file and the source-code.

Wednesday, February 14, 2007

Example 9: The power of Inheritance

The keyword "USE" allows you to inherit from other Objects. Example:-

;;This defines a style named "MyStyleBold"
[Style: MyStyleBold]
Font: Verdana
Bold: Yes
Height: 8



;;This defines a style named "MyStyleBoldLarge" that inherits from style "MyStyleBold"
[Style: MyStyleBoldLarge]
Use: MyStyleBold
Height: 15

You may define Objects that inherit from any other User-defined Object or even from the default TDL Objects. In simple words, you can define a report which inherits from the default TDL report "Balance Sheet" and then you may customize it as per your requirement.

Click here to download the Example 9 compiled file and the source-code.

Example 8: Display a small dialog-box and accept user-input

This programs displays a small dialog-box and prompts the user to input Yes or No. The objective of this program is to teach how to create simple dialog-boxes and accept input from the user.

Click here to download the Example 8 compiled file and the source-code.

Tuesday, February 13, 2007

Example 7: Local and Global Variables

Local Variables
The scope of Local variables is restricted to the Report in which they are defined. Before you can use a local variable, you need to define it. To access the value of a local variable, you must prefix the variable name with symbol #



Local Variable definition
[Variable: myVar]
Type: String



Using the Local variable in your Report
[Report: My Report]
Form: MyForm
Variable: myVar
Set as: "Learn TDL at www.tdlplayground.blogspot.com"



Accessing the Local Variable value
[Field: My Field]
Set as: #myVar



Global Variables
Global variables can be used globally (i.e. in all Reports). A Global variable must be declared in the [System: Variable] section. To access a Global variable, you must prefix the variable name with ##.



Global Variable definition
[System: Variable]
myVar: "Initial Value"



Accessing the Global Variable value
[Field: My Field]
Set as: ##myVar



Other Variable types supported by Tally
1) Logical
2) Date
3) Number
4) Amount
5) Quantity
6) String
7) Rate of Exchange

A sample TDL program (with source-code) has been provided which illustrates the use of Variables. Click here to download the Example 7 compiled file and the source-code.

Saturday, February 10, 2007

TDL basics - An overview

Tally Definition is a proprietory language of "Tally Solutions FZ LLC". It is used to customize the Tally sofware.

TDL is not a full-fledged programming language, but it is a Definition's language. It has its own pros and cons. Using TDL, you can add new menu-options, new reports, new entry screens in Tally 7.2 or Tally 9. However, the programmer does not have any control over the event-driven functionality of Tally.

TDL Basics - An Overview

1. Names are neither case-sensitive nor space-sensitive.
[Report: MyReport] is the same as [Report: MYREPORT]
[Report: My Trial Balance] is the same as [Report: MyTrialBalance]

2. Names should not start with numerals.

3. Comments in TDL are written using double semi-colon (i.e. ;;)

4. A TDL program comprises of TDL statements / definitions and can be written using any text editor (example:- Notepad)

5. To compile TDL program, you require Tally Developer which can be purchased from Tally Solutions or any Tally authorised Dealer. [If you don't have Tally Developer, you may send your TDL programs to mailto:tdlplayground@rtslink.com.

6.All reports in Tally Accounting software have been created using TDL.

7.You can modify existing Menu's in Tally and add your own menu-options. Example:-
[#Menu: Gateway of Tally]
Add: Item: My Reports: Display: rptMyReport

The above code modifies the "Gateway of Tally" menu, and adds a new menu-option "My Reports". When the user clicks on "My Reports" menu-option, it display a report named "rptMyReport". The "#" symbol is used to modify existing definitions.

8.Normally, forms are used in programming languages like VB, VFP, Delphi etc to display text and accept user input. In TDL, you have to use the Report definition which uses the following:-
Report uses Form
Form uses Parts
Part uses lines
Line uses Fields
Field is the real-container where text is displayed.

Remarks:- ratta laga le bhai. Isme samajne jaissa kuch bhi nahi hai.

9.Actions are used to implement/activate the definitions. Example, Display action is used below.
[#Menu: Gatway of Tally]
Add: Item: My Reports: Display: rptMyReport

10. Attributes are like properties. Example, Width and Style
[Field: My Field]
Width: 30
Style: Normal Bold

11. Dimensions in TDL can be expressed in different ways
.
[Form: My Form]
;; This specifies the dimension of the form in centimeters
Width: 15 cms
Height: 25 cms

[Form: My Form]
;; This specifies the dimension of the form in Inches
Width: 2 Inches
Height: 2 Inches

[Form: My Form]
;; This specifies the dimension of the form in screen percentage
Width: 15% screen
Height: 25% screen

12. Some of the important attributes that we shall be using with different Definitions are:-

Width: 30% screen
Height: 30% screen
BackGround: Yellow
Invisible: No
Inactive: No
Set as: "Welcome to TDL"
Space Top: 2
Space bottom: 2
Space Left: 2
Space Right: 2

The above attributes are to be used with their appropriate Definitions only.

13. Button is an attribute of Menu and Form definition and is used to intiate actions.

[Button: My Button]
Title: "My Balance Sheet"
Key: F4
Action: Display: Balance sheet

[#Menu: Gateway of Tally]
Button: My Button

The above code is used to display button "My Balance Sheet" in the "Gateway of Tally" menu. It is invoked by pressing F4 function key.

14.Optional defintions
A TDL program mainly comprisely of definitions and actions. Actions are performed on Definitions to implement/activate them.

TDL allows you to use Optional definitions. In simple words, Optional definition is a definition that is activated/executed if specified condition evaluates to be true. Example:-

;;This is an a regular Form definition
[Form: My Form]
Width: 10% screen
Height: 10% screen
Option: TestForm1: #myVariable

;;This is an optional definition
[!Form TestForm1]
Width: 30% screen
Height: 30% screen

Notes:
a) If the value of variable "myVariable" evaluates to be true, then the optional definition "TestForm1" becomes part of the original definition "My Form".
b) In other words, the original definiton is over-ridden by the Optional definition .

FINAL WORDS
Please send in your views/comments to mailto:tdlplayground@rtslink.com. Please mention whether you found this article to be useful or not. Your valuable suggestions are solicited.

From
Shweta Computers Team
Tally; Tally Developer and Tally Definition Language are trademarks or registered trademarks of "Tally Solutions", Bangalore.