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

Saturday, September 10, 2011

Walk Collection - Example 4

Here's a sample TDL program to get the Ledger Name and Address using the WALK COLLECTION statement.

;;Adds a new option to Gateway of Tally
[#Menu : Gateway of Tally]
 Add : Item : Before : @@locQuit : Walk Collection - Example4 : Call : MyWalkCollectionExample4

;;Collection definition based on Tally Internal Object named LEDGER
[Collection : MyLedgers]
 Type  : Ledger
 ;;Expose/fetch the Name field and Address Collection
 Fetch   : Name, Address.*

[Function : MyWalkCollectionExample4]
 00 : SET FILE LOG ON
 01 : LOG : "***************************"
 
 ;; Loop through the Collection
 05 : WALK COLLECTION : MyLedgers
 
 ;;   Check the address. If empty, then skip the following code.
 10 :  IF : $$IsEmptyCollection:Address
 11:   CONTINUE
 12 :  ENDIF

 ;;  Display the Ledger name 
 14 :  LOG : $Name 
 
 ;;  Loop through the Address Collection and display all the address lines
 15 :  WALK COLLECTION : Address
 20 :   LOG : "=>" + $Address
 25 :  END WALK
 
 30 : END WALK
 90 : SET FILE LOG OFF
 100 : Exec Command  : Notepad  : "TDLFunc.Log" 

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