;;ListVariable Attribute /* ;;Explanation - This example shows how a List Variable is used to store multiple values inside a function. - Here, group names are collected and added to the list one by one using a counter as the key. - List Variables help store and manage a set of values during function execution. ;;Syntax [Function : ] ListVariable : : or [Function : ] ListVar : : */ ;;=== Function Definition executing ListVariable Attribute [Variable: List Var] [System: Variable] List Var : List Var [Function: TSPL ListVariableFunction] List Variable : List Var : String ;; List Variable is declared here 01 : DISPLAY : TSPL ListVariableAttribute [Function: List Fill Value] ;; Add elements to the list Variable : Counter : Number 00 : List Delete : List Var 01 : WALK COLLECTION : Group 02 : INCREMENT : Counter ;; Action List Add adds an element to the List Variable ;; Parameters for the same are List Variable Name, Key and the Value 03 : LIST ADD : List Var : ##Counter : $Name ;; List Var is the List Variable Name, Counter Value is assigned to he Key and ;; Group Name is assigned as the Variable Value 04 : END WALK 05 : CALL : List Print : "List Added with Counter as Key and Group Name as Value" ;; The Following Button and Function is added to Delete a single key entered by user ;; in the Report List DelVar [Function: List Print] Parameter : Header : String 00 : SET FILE LOG ON 01 : LOG : "---" + ##Header + "---" 02 : FOR IN : KeyVar : List Var 03 : LOG : "Key: " + $$String:##KeyVar + " Value: " + $$ListValue:ListVar:##KeyVar 04 : END FOR 05 : LOG : "-----------------------------------------------" 06 : SET FILE LOG ON ;;=== Button Definition call the function [Button : TSPL ListVariableButton] Title : "List var - Add" Key : Alt + A Action : CALL : List Fill Value ;;=== Report to demonstrate the working of 'ListVariable' attribute in Function definition using Button 'TSPL ListVariableButton' [#Menu: Gateway of Tally] Add : Item : "ListVariable Attribute" : Display : TSPL ListVariableAttribute [Report: TSPL ListVariableAttribute] Form : TSPL ListVariableAttribute [Form: TSPL ListVariableAttribute] Part : TSPL ListVariableAttribute Button : TSPL ListVariableButton [Part: TSPL ListVariableAttribute] Line : TSPL ListVariableAttribute Border : Thin Box [Line: TSPL ListVariableAttribute] Field : TSPL ListVariableAttribute Border : Thin Box [Field: TSPL ListVariableAttribute] Use : Name Field Set as : "On pressing Alt + A, the group names will be logged as List Variable values." Style : Normal Bold Width : 15 Cms ;;End of File