;;Variable Attribute /* ;;Explanation - This example demonstrates the use of the Variable attribute to declare function-level variables. - VarStkItem and VarBatchNm are simple variables used within the function for intermediate processing. - During execution, the function compares the stock item name and stores the matched batch name in VarBatchNm. - When a data type is specified, the variable is treated as an inline variable and is available only within the function scope. ;;Syntax [Function : ] Variable : : */ ;;=== Function Definition executing Variable Attribute [Function: TSPL VariableFunction] Variable : VarStkItem : String Variable : VarBatchNm : String 150 : Msg Box : "Check": ##VarStkItem 100 : Walk Collection : TSPL StockItemBatchList 200 : If : $ItemName = ##VarStkItem 300 : Set: VarBatchNm : $BatchName 350 : Log: "Batch Name - " + ##VarBatchNm 400 : End If 500 : End Walk [Collection: TSPL StockItem] Title : "List of Stock Items" Type : Stock Item [Collection: TSPL StockItemBatchList] Source Collection: TSPL StockItem Walk : Batch Allocations Compute : ItemName : $$Owner:$Name Fetch : Name,Parent,BatchName ;;=== Button Definition call the function [Button : TSPL VariableButton] Title : "Click here" Action : Execute : TSPL selectItem Key : Alt + R [Report: TSPL selectItem] Title : "Select Item" Form : TSPL selectItem [Form: TSPL selectItem] Part: TSPL selectItem On : Form Accept : Yes : Call : TSPLVariableFunction:#TSPLselectItem On : Form Accept : Yes : Form Accept [Part: TSPL selectItem] Line : TSPL selectItem [Line: TSPL selectItem] Field : medium prompt, TSPL selectItem Local : Field: medium prompt : Set as: "Select Stock Item" Height : 6 mms [Field: TSPL selectItem] Use : Name Field Table : TSPL StockItem Show Table : Always Width : 3 Cms ;;=== Report to demonstrate the working of 'Variable' attribute in Function definition using Button 'TSPL VariableButton' [#Menu: Gateway of Tally] Add : Item : "Variable Attribute" : Display : TSPL VariableAttribute [Report: TSPL VariableAttribute] Form : TSPL VariableAttribute [Form: TSPL VariableAttribute] Part : TSPL VariableAttribute Button : TSPL VariableButton [Part: TSPL VariableAttribute] Line : TSPL VariableAttribute Border : Thin Box [Line: TSPL VariableAttribute] Field : TSPL VariableAttribute Border : Thin Box [Field: TSPL VariableAttribute] Use : Name Field Set as : "On pressing Alt + R, the Batch List will be displayed in Log on the Item Selection." Style : Normal Bold Width : 15 Cms ;;End of File