;;Return Attribute /* ;; Explanation - This example shows the use of the 'Return' in a function. - The function calculates the difference between the closing and opening balance and returns the result. - When Return is executed, the function stops running and control goes back to the calling program with the calculated value. ;;Syntax [Function : ] Return : */ ;;=== Function Definition executing Return Attribute [Function: TSPL ReturnFunction] Parameter: VarOpBalance : Amount Parameter: VarClBalance : Amount Variable : VarDiffAmount: Amount Return : Amount 100 : Set : VarDiffAmount : ##VarClBalance - ##VarOpBalance 200 : Return : ##VarDiffAmount ;;=== Report to demonstrate the working of 'Parameter' attribute in Function definition using Button 'TSPL ParameterButton' [#Menu: Gateway of Tally] Add : Item : "Return Attribute" : Display : TSPL ReturnAttribute [Report: TSPL ReturnAttribute] Form : TSPL ReturnAttribute [Form: TSPL ReturnAttribute] Part : TSPL ReturnAttribute [Part: TSPL ReturnAttribute] Line : TSPL ReturnAttributeTit, TSPL ReturnAttribute Repeat : TSPL ReturnAttribute : TSPL LedgerList Border : Thin Box [Line: TSPL ReturnAttributeTit] Field : TSPL LedgerName,TSPL LedgerOp,TSPL LedgerCl,TSPL LedgerDiff Local : Field : Default : Type : String Local : Field : Default : Align : Center Local : Field : Default : Style : Normal Bold Local : Field : TSPL LedgerName : Set as: "Ledger Name" Local : Field : TSPL LedgerOp : Set as: "Opening Balance" Local : Field : TSPL LedgerCl : Set as: "Closing Balance" Local : Field : TSPL LedgerDiff : Set as: "Difference" Height : 6 mms Border : Thin Bottom [Line: TSPL ReturnAttribute] Field : TSPL LedgerName,TSPL LedgerOp,TSPL LedgerCl,TSPL LedgerDiff Height : 6 mms Border : Thin Bottom [Field: TSPL LedgerName] Use : Name Field Set as : $Name Style : Small Bold Width : 7 Cms Border : Thin Right [Field: TSPL LedgerOp] Use : Amount Field Set as : $OpeningBalance Style : Small Bold Width : 3 Cms Border : Thin Right [Field: TSPL LedgerCl] Use : Amount Field Set as : $ClosingBalance Style : Small Bold Width : 3 Cms Border : Thin Right [Field: TSPL LedgerDiff] Use : Amount Field Set as : $$TSPLReturnFunction:#TSPLLedgerOp:#TSPLLedgerCl Set Always: Yes Style : Small Bold Width : 3 Cms [Collection: TSPL LedgerList] Type : Ledger Fetch : Name, OpeningBalance, ClosingBalance ;;End of File