Tally ERP 9 | Tally 9 | Tally 8.1 | Tally 7.2 | Tally 6.3 | Learn Tally TDL

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.

Tally; Tally Developer and Tally Definition Language are trademarks or registered trademarks of "Tally Solutions FZ LLC", Bangalore.