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

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.
Tally; Tally Developer and Tally Definition Language are trademarks or registered trademarks of "Tally Solutions", Bangalore.