text
stringlengths
0
5.42k
source
stringclasses
1 value
What's New in Release 4. 61 39 1 In the codes shown in the table, the Interface Add of Class Math Class had the Parameter Data type as Double in DLL, while the same had to be mapped to Number as the Parameter Data type in TDL. From Release 4. 61 onwards, the COM Data Types listed in 'Other Permissible TDL Da ta Types' column in the table are also supported. Thus, in this particula r example, the data type of the Parameter can also be specified as Double in place of Number, and hence, the same can be rewritten as: Parameters : p1 : Double : In However, while invoking the COM Server, the data type must be a TDL Data Type, viz. Number, String, Amount, Date OR Logical. DLL Code TDL Code ‐ COM Interface Definition using System; using System. Collections. Generic; using System. Linq; using System. Text; namespace Math Lib { public class Math Class{ public double Add(double p Double) { return p Double + 9; } } }[COM Interface : TSPL Smp Add] Project : Math Lib Class : Math Class Interface : Add Parameters : p1 : Number : In Returns : Number
TDL_Reference_Manual.pdf
What's New in Release 4. 61 392 Example: [Function : TSPL Smp Addition] Parameter : Input No : Number 00 : Exec COM Interface : TSPL Smp Add : ##Input No 10 : Log: $$Last Result It is not necessary to have the above TDL Data T ype as Number. It could also be a String or an Amount. However, the value within the String should be a Number.
TDL_Reference_Manual.pdf
393 What's New in Release 4. 6 1. COM DLL Support in TDL A dynamic link library (DLL) is an executable file that acts as a shared library of function s. Dynamic linking provides a way f or a process to call a function that is not part of its executable code. The executable code for the function is located in a DLL, which contains one or more functions that are compiled, linked, and stored separately from the processes that use them. Multiple applications can simultaneously access the contents of a single copy of a DLL in memory. DLL support has been provided in TDL for quite a while. The focus was primarily on extending T ally for bringing in capabilities which could not be achieved within T ally. 'Call DLLFunction ' allowed calling native/unmanaged DLLs which were written and co mpiled in C++. In further releases, this moved a step further where the suppor t was extended to use Plug-In and Activex Plug-In, where the XML output from the DLL could be used as a data sour ce in the collection artefact, and thereby, consumed in TDL. This paved the way for new possibilities on extending T ally as per customer needs, which required interacti ons with external hardware, etc. However, this required changes in the DLL as per the processing capabil ities of the collection. The XML output from the collection had to be necessarily from a function within DLL which had to be named mandatorily as TDLCollection within the DLLClass. The Component Object Model (COM) is a component software architecture that allows applications and systems to be built from components supplied b y different software vendors. COM is the underlying architecture that forms the foundation for higher le vel software services. These DLLs provide the standard benefits of shared libraries. Component Ob ject Model (COM) was introduced by Microsoft to enable inter process communication a nd dynamic object creation across a varied range of programming languages. In other words, objects can be implemented in environments seamlessly different from the one in which they ar e created. This technology specifies manipulation of data associated with objects through an Interfa ce. A COM interface refers to a predefined group of related functions that a COM class implemen ts. The object implements the interface by using the code that implements each method of the interface, and provides COM binary-compliant pointers to those functions, to the COM librar y. COM then makes those functions available to the requesting clients. COM DLL Support will pave the way for providing features like 'T ally For Blind' using the generic speech API provided by Microsoft. This Release comes with enhan ced capabilities in the language to support COM DLL processing. A new definition type c alled COM Interface has been introduced for the same. 1. 1 COM Servers and COM Clients A COM Server is any class/method that provides services to clients. These se rvices are in the form of interface implementations which can be called by any cl ient that is able to get a pointer to one of the interfaces on the server object. A COM Client makes use of a COM Server, and uses its services by calling the methods of its interfaces.
TDL_Reference_Manual.pdf
What's New in Release 4. 6 394 COM Server DLLs are DLLs which have objects exposed to COM and can be used by COM Clients. Let's take the following DLL Code as an example: using System; using System. Collections. Generic; using System. Linq; using System. Text; namespace Math Lib { public class Math Class { public double Add(double p Double){ return p Double + 9; }public int Divide(int Dividend, int Divisor, out int Remainder) { int Quotient;Quotient = Dividend/Divisor; Remainder = Dividend-(Divisor * Quotient);  return Quotient; }public void datefunc(ref Date Time date) { date = date. Add Days(40); } } } In C# DLL, three functions are called. They are: Add-it takes an input parameter, and returns it, after adding 9 to it.
TDL_Reference_Manual.pdf
What's New in Release 4. 6 39 5 Divide-it accepts a Dividend and a Divisor as inputs, and returns the Quotient, along with the Remainder. datefunc-it accepts a parameter 'date' as input, and updates it by addi ng 4 0 days to it. 1. 2 Registering the DLL For. NET COM Servers, we need to register with a parameter /Code Base. Example: regasm/Code Base <DLL Name with absolute path> For further details on steps to register DLLs, please refer to the section How to Register DLLs. 1. 3 Implementation in T ally. ERP 9 using TDL A new definition 'COM Interface' has been introduced to call a function available in external DLL/ EXE (COM Server). This will help the TDL Developer to use exter nal libraries and devices. With this enhancement, T ally. ERP 9 can now act as a COM Client. Definition-COM Interface The definition 'COM Interface' has been introduced to accept th e external DLL/EXE details like Project name, Class name, Function name and other required para meters. Syntax [COM Interface : <COM Interface name>] Where, <COM Interface name> is the name of the COM Interface definition. Attributes supported by definition 'COM Interface':The following attributes are supported in this definition: Attribute-PROJECT This attribute is used to specify the name of the project. Syntax Project : <Project Name> Where, <Project Name> is the name of the Project/Namespace of the COM Server. If the DLL is written using VB. NET or C#. NET ; before building the DLL, please ensure that the COM Visible Property is set. After registering the DLL, ensure that the registry entries are available as under: Prog ID : The value for which should be <Project Name>. <Class Name> Inprocserver32 OR Inproc Handler32 OR Local Service-The default value for these keys in registry should be the path to the DLL/EXE which we haveregistered. T o find the Registry Entry, one can open regedit, and locate the project name of the DLL that has been registered and ensure the above.
TDL_Reference_Manual.pdf
What's New in Release 4. 6 396 Attribute-CLASS This attribute is used to specify the Class name under the proj ect specified. Syntax Class : <Class name> Where, <Class Name> is the name of the Class of the COM server to be used. Attribute-INTERFACE This attribute is used to specify the interface name under the class that needs to be executed. It corresponds to the name of the function within the DLL Class to be executed. Syntax Interface : <Interface name> Where, <Interface Name> is the name of the actual Interface name of the DLL which is to be called. Attribute-P ARAMETER This attribute denotes the list of parameters along with their data types required by the COM Interface. The TDL Data types supported are: Number Long String Logical Date Syntax Parameter : <Parameter Name> : <Data type> [: <Parameter Type>] Where, <Parameter Name> is the name of the Parameter. <Data T ype> is the data type of the parameter being passed. <Parameter T ype> is the nature of the parameter, viz. In (Input), Out (Output) or In Out (Both Input and Output) For instance:Parameter of type String for acc epting output will be written a s: Parameter : Parm1 : String : Out In the absence of the specification of the nature of Parameter, the parameter is defaulted as in parameter
TDL_Reference_Manual.pdf
What's New in Release 4. 6 39 7 Attribute-Returns This attribute denotes the return data type of the COM Interfac e. Syntax Returns : <Return Data Type> Where, <Return Data T ype> is the data type of the value returned by the COM Interface. Let us define the COM Interfaces required for the previous DLL code: [COM Interface : TSPL Smp Addition] Project : Math Lib Class : Math Class Interface : Add Parameters : p1: Number : In Returns : Number [COM Interface : TSPL Smp Division] Project : Math Lib Class : Math Class Interface : Divide Parameters : p1 : Long : In Parameters : p2 : Long : In Parameters : p3 : Long : Out Returns : Long [COM Interface : TSPL Smp Add Date] Project : Math Lib Class : Math Class Interface : Date Func All the parameters must sequentially correspond to the ones accepted by the COM Interface.
TDL_Reference_Manual.pdf
What's New in Release 4. 6 398 Parameters : p1 : Date : In Out In this code, 3 COM Interfaces are defined, each for executing 3 different f unctions inside DLL: Math Lib is the DLL Project Name Math Class is the DLL Class under the Project Math Lib Add, Divide and Date Func are the Functions under the Class Math Class, which are specified in the Attribute Interface. Action-Exec COM Interface A new action Exec COM Interface has been introduced to invoke the defined COM Interface. Syntax Exec COM Interface: <COM Interface name> [: <Parameter 1> [: <Parameter 2>...... [: <Parameter N>]... ]] Where, <COM Interface Name> is the name of the COM Interface Definition. [: <Parameter 1> [: <Parameter 2>...... [: <Parameter N>]... ]] are the subsequent parameters, which are passed considering the following aspects: If the parameter corresponds to IN parameter, it can take any expression or constant. If the parameter corresponds to an OUT or an In Out Parameter, then only the variable name must be specified, without prefixing a ##. In other words, expr essions are not supported. The variable, in case of: a) In Out Parameter, will send the variable value to the Interface as input, and in return, will bring back the value altered by the Interface. b) Out Parameter, will only bring back the updated value from the DLL. In the previous TDL Code, three COM Interfaces are defined. A f unction is then called, inside which the action Exec COM Interface is used to invoke the COM interface definitions as follows: [Function : TSPL Smp Execute COM Interfaces] Variable : p1 : Number : 90 Variable : p2 : Number : 102 Variable : p3 : Number : 5Variable : p4 : Number Variable : p Date : Date 00 : Exec COM Interface : TSPL Smp Addition : ##p1 10 : Log : $$Last Result20 : Exec COM Interface : TSPL Smp Division : ##p2 : ##p3 : p4 25 : Log : $$Last Result
TDL_Reference_Manual.pdf
What's New in Release 4. 6 39 9 30 : Log : ##p4 40 : Set : p Date : $$Date : "20-04-2013" 50 : Exec COM Interface : TSPL Smp Add Date :p Date 60 : Log : ##p Date Function-$$COMExecute This function is similar to the Action Exec COM Interface, except that Interfaces with only In Parameters can be executed with the Function $$COMExecute. In o ther words, this Function can only execute a 'COM Interface', if it has no Out Parameters. Syntax $$COMExecute : <COM Interface name>: [<Parameter 1>[:<Parameter 2> [.... [: <Parameter n>]....]]] Where, <COM Interface Name > is the name of the COM Interface definition. [<Parameter 1>[:<Parameter 2>[....[:<Parameter n>]....]]] are the IN parameters, which correspond to the parameters specified in the COM Interface def inition. As mentioned earlier, the first function of DLL only takes In Parameters. Hence, the function COMExecute can be used only for the first COM Interface definit ion in the example shown above. Example: $$COMExecute : TSPLSmp Addition : ##p1 Function-$$Is COMInterface Invokable This function just checks if the 'COM Interface' description wh ich was defined, could be used or not. If the COM class of the interface is not available in the COM server, it would return FALSE; while if the class and the function invoked in the COM class ar e present, then the interface is invokable, and hence TRUE would be returned. Syntax $$Is COMInterface Invokable : <COM Interface name>If this Action is invoked from within a TDL function, then the Objects created are retained until all the Actions within the f unction are executed. This behaviour was designed so that multiple functions in a COM Class can be used on the same COM Object (state of COM Object is maintained). For instance, there are some functionsof a COM server which depend on each other, and are required to be called in sequence, then the same object needs to be present and functions should be called on that same object to give correctness. As a Global action, this would create a COM Object once per COM Interface execution. In other words, if there are two functions of a COM Server and they depend on each other, then this action would work only if used within a procedural Code.
TDL_Reference_Manual.pdf
What's New in Release 4. 6 400 Where, <COM Interface name> is the name of the COM Interface Definition. Scope and Limitations : Only a COM Server which implement s its classes using IDispatch interface (Automation interface of COM), can be used with this. For other Native DLLs (DLLs that contain raw processor directly-executable code, e. g., Win32 DLL) or ones which do not c omply with the above, another wrapper DLL can be made which makes use of it and exposes the functionality to TDL. The data types supported are Long, Number, String, Logical and Date, which are mapped to the following data types in IDL: Out parameters are supported in this capability. But, functions which take other data types than specified in the table are currently not supported in TDL, and hence, cannot be used. 2. Developer Mode In market, there are customers using T ally. ERP 9 for their day-to-day operations. There are also developers/ partners who build solutions within the product to suit the customer requirements. For the entire spectrum of persons using T ally. ERP 9, the only mode of execution available uptil now was the default mode. In order to empower the developers of T ally with various tools which will help them to build solutions optimally and efficiently, the very new Developer Mode has been introduced. From Release 4. 6 onwards, T ally can operate in 2 modes, viz. Normal Mode which will be used by the end users, and the Developer Mode, which will be used by the developers. The Developer mode will offer various tools for debugging the code and optimi zing the performance of reports. The various T ools introduced for TDL Developers in Developer Mo de are: 1. Profiler Profiler is a very useful tool in the hands of the TDL Programm er. Usually, any requirement can be achieved in multiple ways using TDL. But, it is highly difficul t for the programmers to choose the optimal way. Using Profiler, programmers can check the time taken to execute each TDL artef act, along with the count of how many times they have been executed. This ensures redundancy check, and the code can be optimized for the best performance a nd user experience. 2. Expression Diagnostics This is a very handy tool for the TDL Programmer. At times, while writing complex expressions for huge projects, it becomes difficult to identify the expression that has faile d. Usually, for debugging such code, TDL Programmers had to resort to invoking User Defin ed Functions and logging the IDL Type Parameter data type in TDL Signed Int Long Double Number BSTR String Boolean Logical Date Date
TDL_Reference_Manual.pdf
What's New in Release 4. 6 40 1 values to trace the point of fa ilure. With Expression Diagnosti cs, now the system automatically dumps every expression along with their resultant value in the log. For expressions which have failed to execute, the resultant value would be set to FAILED. With this, the pro grammer can easily reach the exact expression that has failed and correct t he same without much delay. This would save a lot of programmer's time, which can be used for ot her projects. 3. Key Recording, Playback and Triggering the Keys This feature will be useful in instances where developers requi re to execute certain keystrokes repetitively to test/ retest the code output and confirm if the same is in line with the customer requirement. It will help in doing automated QA and ensuring ut most quality for the customer. For instance, if a data entry screen has been customised by incorporating ad ditional fields, sub-forms, etc., then in order to validate if the data entry performance i s affected, one can record the keystrokes for saving a voucher, and replay them as many times as required. 4. Onscreen T ooltip While developing extensions on T ally, developers usually navigate through default TDL to locate the appropriate definition name and alter their attributes with in their code. At times, it becomes very difficult for the developers to identify the right field n ames, since there are several options at various stages and finding the right ones requires a lot of eff ort. Hence, to make developer's life easier, a v e r y c r i t i c a l t o o l, i. e., the Onscreen T ooltip, has been introduced. When the mouse pointer is placed on a Field, the definition name of the Field is displayed. If the pointer points at a place where no field exists, the definition name of the Report is displayed. All these T ools/Enhancements will be available only if the deve loper executes T ally in Developer Mode, using the Command Line Parameter Dev Mode. Command Line Parameter-Dev Mode Command Line Parameter Dev Mode has been introduced to execute T ally in Developer mode. Syntax <Tally Application Path>\Tally. exe /Dev Mode Example: C:\Tally. ERP9\Tally. exe /Dev Mode On invoking T ally in Developer Mode, the T ally Screen is as sho wn below: Figure 1. T ally..ERP 9 in Developer Mode
TDL_Reference_Manual.pdf
What's New in Release 4. 6 402 Function-$$In Developer Mode This function is used to check if T ally is currently working in Developer mode. It returns TRUE if the T ally application is in Developer Mode, else returns FALSE. This tool can be used when the developer needs to write some ad ditional code for testing purpose, so that the testing code does not appear to the end us er, thereby executing only if the product is running in Developer Mode. Syntax $$In Developer Mode Example: Option : Dev Mode Default Menu : $$In Developer Mode Let us discuss the tools/capabilities and their usage, in detail: 2. 1 Profiler As briefed before, Profiler is a useful tool which helps the de velopers to check the performance of the TDL Program, thus optimizing the code. It returns the execu tion time and count of the various TDL artefacts. It gathers information of Collections, User Defi ned Functions and Expressions. The steps to get the profiler information are: Start the Profiler Execute the desired Report Dump the Profiler and/or Stop the Profiler, with the file name The dumped profiler information when opened in T extpad, is as shown below:Developers must not execute the above at the Client end unless required, because if the client continues to work in this m ode, it might affect the performance adversely. Extensive use of this function in the TDL code may lead to performance issues even in Normal mode.
TDL_Reference_Manual.pdf
What's New in Release 4. 6 40 3 Figure 2. Dumped Profiler Information As seen in the figure, the profile information shows the time t aken for evaluating every expression as well as how many times (Count) the same expression or collec tion was evaluated/ gathered. Developers are already aware that apart from performing various arithmetic operations, Calculator Panel can also be used to issue select Queries like Select $Name, $Parent from Ledger, Select * from Company, etc. Now, the Calculator Pane can also be used by developers for Profiling, Debugging, Key Recording and Playing back by setting various modes. Commands used for Profiling The following Calculator Pane Commands are supported for the pr ofiling information: Profiler Mode It sets the mode to Profiler, which means that Profiling Commands will be accepted. It provi des certain calculator pane commands to the developer in order to c heck the performance of code. Syntax MODE: Profile
TDL_Reference_Manual.pdf
What's New in Release 4. 6 404 Figure 3. Issuing commands in the Calculator Pane in Profiler Mode Once mode is set to Profile, commands issued in the Calculator Pane work in Profiling Context. Start This command starts gathering the count and time taken for eval uating a TDL Artefact in memory. Syntax START Stop This command is used to end the profiling. Syntax STOP Dump This command is used to dump the collected profile data to the file tdlprof. log. It also clears the memory once the data is dumped. Syntax DUMP Dumpz This command is used to dump the collected profile data, includ ing artefacts which have consumed negligible time, i. e., zero processing time, into the file tdlprof. log. It also clears the memory after updation to the file. Syntax DUMPZ Status It checks the status of the profiler, and returns the statement Profiler is ON or Profiler is OFF. Syntax STATUS Reset This command is used to clear the existing profile data from th e Memory. Syntax RESET
TDL_Reference_Manual.pdf
What's New in Release 4. 6 40 5 Help This command gives the list of Profiler commands, with descript ion of their purpose. Syntax HELP Actions used for Profiling Apart from Calculator Pane Commands, there are several other TD L Actions provided, to programmatically execute the profiling operations. They are: Action-Start Profile This action is used to start the profiling. The Count, Time and other usage information of every function, collection, etc. gathered along with expressions with in the report, are profiled in memory. Syntax Start Profile Example: [Button : Start Profiling] Key : Alt + S Action : Start Profile Action-Dump Profile This action is used to dump all the profiled information to the file. It also clears the memory after dumping the information. Syntax Dump Profile [: <File Name>[: <Logical Value>]] Where, <File Name> is the name of the file to which the information has to be writ ten. In the absence of the 'File Name' Parameter, the default file updated will be tdlprof. log <Logical Value> if set to YES, the 'Dump Profile' action also includes zero tim e-taking artefacts. If it is enabled, the action is similar to calculator pane command Dump Z, else it is similar to Dump. Example: [Button : Dump Profiling] Key : Alt + R Action : Dump Profile : “Profiled @ ” + @@System Current Time Action-Stop Profile This action is used to stop the profiling. If the Optional parameter 'File Name' is passed, then information is also dumped into the file, without requiring the action Dump Profile. Syntax Stop Profile [: <File Name>]
TDL_Reference_Manual.pdf
What's New in Release 4. 6 406 Where, <File Name> is the name of the file to which the information has to be writ ten. Example: [Button : Stop Profiling] Key : Alt + T Action : Stop Profile Functions used for Profiling The following function has been introduced to support profiling : Function-$$Is Profiler On This function is used to check the current status of the TDL Pr ofiler. It returns logical value TRUE, if the status of the profiler is ON. Syntax $$Is Profiler On Example: [Function : Switch Profiler On Off] 10 : If : $$Is Profiler On 20 : Stop Profile30 : Else 40 : Start Profile 50 : End If 2. 2 Expression Diagnostics This will help the developers to de bug the TDL Program much fas ter by evaluating the complex expressions and logging the values evaluated at every stage. In other words, this feature would provide the breakup of the expression, the result of each sub-expression, as well as the expression which has failed to evaluate. The steps to get the Expression Diagnostics information are: Start the Expression Diagnostics Execute the desired Report Dump the information and/or Stop the Expression Diagnostics wit h the file name. The dumped debugger information, when opened in T extpad, is as shown below:
TDL_Reference_Manual.pdf
What's New in Release 4. 6 40 7 Figure 4. Dumped Debugger Information As seen in the figure, each expression in the developer's code, as well as the default codes are evaluated and the result values are shown for the purpose of de bugging. If any expression evaluation fails, the Result would display as Failed. Commands used for Expression Diagnostics The Calculator pane commands used for Expression Diagnostics ar e as follows: Debugger Mode This sets the mode to Debug, which means that any Debugging Commands will be accepted. It provides certain calculator pane commands in the hands of de veloper in order to diagnose the errors in the code, as well as to evaluate and/or set the value s to the environment variable. Syntax MODE: Debug Figure 5. Issuing Debugging c ommands in the Calculator Pane Once mode is set to Debug, commands issued in the Calculator Pa ne will work in Debug Context. Start Start command is used to start diagnosing the data. Subsequent to issuing this command, when any report is viewed, the data will start gathering every expre ssion along with their values, and will be updated in the log file later. Syntax START Dump This command dumps the collected Expressions data to the file tdldebug. log. It also clears the memory.
TDL_Reference_Manual.pdf
What's New in Release 4. 6 408 Syntax DUMP Status This command is used to check the status of the debugger and re turns the statement Expression Debugger is ON or Expression Debugger is OFF. Syntax STATUS Eval This calculator pane command is used for evaluating an expressi on. Example: EVAL : ##SVFrom Date In this example, the value of SVFrom Date will be returned in the Calculator Pane. Set A variable value can also be set from within a Calculator Pane. This feature helps the developer to set the variable value in the Calculator Pane itself and check the behavioral change. This will speed up the testing process of the Developer by not requiring him to write the code, create an interface element to alter the variable values, and then check the same. Example: SET : DSPShow Opening : Yes This will set the value of the variable DSPShow Opening. For instance, prior to viewing Trial Balance, one can set the value of this variable in the Calculat or Pane and the Trial Balance will be displayed with the Opening Column. Print Print displays the value of a system variable. Example: Print : SVFrom Date This will return the SVFrom Date value. Reset This command is used to clear the existing diagnosis data from Memory. Example: RESET Stop This command will stop further diagnosis of data. Example: STOP
TDL_Reference_Manual.pdf
What's New in Release 4. 6 40 9 Help This gives the list of Debug commands, with description of thei r purpose. Example: HELP Actions used for Expression Diagnostics Apart from Calculator Pane Commands, there are several TDL Acti ons provided to programmatically execute the debugging operations. They are: Action-Start Debug This action is used to start debugging. All expressions evaluat ed would be debugged. The information collected can be dumped to a file anytime. Syntax Start Debug Example: [Button : Start Debugging] Key : Alt + D Action : Start Debug : “Debugged @ ” + @@System Current Time Action-Dump Debug This action is used to dump all debugging information to the fi le. It also clears the diagnosis data from the memory, once dumped. Syntax Dump Debug:<File Name> Where, <File Name> is the name of the file to which the information has to be writ ten. Example: [Button : Dump Debugging] Key : Alt + E Action : Dump Debug : “Debugged @ ” + @@System Current Time Action-Stop Debug This action is used to stop debugging. If the file name is pass ed, then the information is also dumped into the specified file. Syntax Stop Debug [: <File Name>] Where, <File Name> is the name of the file to which the information has to be writ ten.
TDL_Reference_Manual.pdf
What's New in Release 4. 6 410 Example: [Button : Stop Debugging] Key : Alt + O Action : Stop Debug : “Debugged @ ” + @@System Current Time Functions used for Expression Diagnostics The following function has been introduced to support Debugging operations: Function-$$Is Debugger On This function is used to check the current status of the Expres sion Debugger. It returns logical value TRUE if the status of the Debugger is ON. Syntax $$Is Debugger On Example: Inactive : NOT $$Is Debugger On 2. 3 Key Recording and Playback The recording and playback features will allow the developers t o record all the keyboard keys and later play/replay them, as and when required. This will help the developers to automate and replay certain ke ystrokes repeatedly during testing of the code for various performance testing needs, as well as w hile debugging a project, and automate multiple steps required to do the needful. The steps to get the Key Recording done are: Start the Recording Navigate through the sequence of key strokes Dump the Recorded information Stop the Recording The dumped recorded information when opened in T extpad, is as shown below: Figure 6. Dumped Recorded Information As seen in figure, the macros are appended to the file macros. log within the application path. Comma-separated Keys are written in the file against each macro name separated with the separator symbol specified while dumping the macro from the mem ory to the file. Commands used for Key Recording and Playback The following Calculator Pane Commands are supported for Key Re cording and Playback:
TDL_Reference_Manual.pdf
What's New in Release 4. 6 41 1 Record Mode Record Mode gives various commands to help the developer in rec ording keys. The mode should be set by specifying the mode as Record. Syntax MODE : Record The following commands can be specified in the Calculator Pane once the Mode is set to Record: Start This command is used to start recording a macro. Syntax Start[: <Macros name>] Where, <Macros name> is the name assigned to a macro. In the absence of a Macro Name, it is defaulted to the name Macro. Example: START : BSView Replay It is used to replay the recently recorded macro from the memor y, but before the same is dumped into a file. If the macro is already dumped into a file, the sa me is cleared from the memory and will not be available for Replay. The macro from the file can then be replayed using File I/O Ap proach and Action 'Trigger Key' (explained later), but cannot be repla yed through Calculator Pane. Syntax REPLAY Pause This command is used to paus e the recent recording. Syntax PAUSE Resume This command is used to resume the recently paused recording. Syntax RESUME Dump This command is used to dump the recording to the file macros. log. The macro name will be separated from the keys with the 'separator character' specifie d as the parameter. It also clears the keys in the memory. Syntax DUMP[: ~]
TDL_Reference_Manual.pdf
What's New in Release 4. 6 412 Stop This command is used to stop recording the recent macro. Syntax STOP LS This command is used to list the macros which are recorded and available in the memory. The dumped macros will not be listed as they are cleared from the m emory as soon as they are dumped in the file. Syntax LS Help This command provides a list of all the recording commands, wit h description of their purpose. Syntax HELP Actions used for Key Recording and Playback Apart from Calculator Pane Commands, there are several TDL Acti ons provided to programmatically execute the Key Recording operations. They are : Action-Start Recording This action is used to start recording every key entered in the memory, with the specified macro name. In the absence of optional parameter Macro Name, default name assumed will be 'Macro'. Syntax Start Recording[ : <Macro Name>] Where, <Macro Name> is the name of the macro to be recorded in memory. Example: [Button: Start Recording] Title: "Start" Key: Alt + CAction: Start Recording: "BS View"T o reset command prompt to regular behaviour, you need to mention MODE. T o perform all the above actions or Calculator Pane Commands, T ally must be executed in Dev Mode.
TDL_Reference_Manual.pdf
What's New in Release 4. 6 41 3 Action-Pause Recording This action pauses the recording, which can be resumed further. For instance, while recording multiple Vouchers, we might have to run through the Report to c heck the Number of vouchers, Amount, etc., and then resume recording the Vouchers. Syntax Pause Recording Example: [Button : Pause Recording] Title : "Pause" Key : Alt + U Action : Pause Recording Action-Resume Recording This action resumes the paused recording. Syntax Resume Recording Example: [Button : Resume Recording] Title : "Resume" Key : Alt + M Action : Resume Recording Action-Dump Recording This action dumps all the recordings to a file with the given s eparator. Each recording is dumped with its name and keys. This also clears the keys in the memory. Syntax Dump Recording : <Macro Name> : <Separator between keys> Where, <Macro Name> is the name of the macro recorded in memory. <Separator between keys> is the separator to be used between the recording name and keys. Example: [Button : Dump Recording] Title : "Dump" Key : Alt + G Action : Dump Recording : “BSView” : “,”
TDL_Reference_Manual.pdf
What's New in Release 4. 6 414 Action-Stop Recording This action stops the recording. Syntax Stop Recording Example: [Button : Stop Recording] Title : "Stop" Key : Alt + N Action : Stop Recording Action-Trigger Key When the macro keys are recorded using Key Recording Actions or when they are dumped into the Macros File from the Calculator Pane Command; in order to p lay them back, one needs to make use of the Action Trigger Key, which sends the list of keys in sequence to the system as if an operator is pressing those Keys. The Keystrokes of a require d macro can be copied from Macro Log file and pasted agains t the 'Trigger Key' Action, whi ch triggers all those Keys in sequence as required. Also, Trigger Key accepts a value with Inverted Quotes, which m eans-trigger this as a value in the current field. For example, V, “Cash”, etc. If the triggered keys enclosed within quotes (“ ” ) are executed from a menu, they will be considered as menu keys. For example, “ DAS ” from Gateway of T ally menu will take the user through Display-> Account Boo ks-> Sales Register. Syntax Trigger Key : <Comma Separated Keys/Values> Example: Trigger Key : V, F5, Enter, "Cash", Enter, "Conveyance", Enter, "50", Ctrl+A Functions used for Key Recording The following function has been introduced for key recording: Function-$$Recorder Status This function is used to check the status of the recorder. It returns a String value to indicate whether it is in Started, Stopped or Paused mode. The recordings once dumped in a file against a name using the above actions, can be replayed by reading the file using File I/O approach and T riggering the keys in a loop using the Action 'T rigger Key', which will be covered ahead.
TDL_Reference_Manual.pdf
What's New in Release 4. 6 41 5 Syntax $$Recorder Status 2. 4 Onscreen T ooltip At times, it becomes difficult for the developer to navigate th rough the default TDL and identify the fields that are used in the target report. Hence, the Onscreen T ooltip feature has been provided for the developers, who can identify the Field/ Report Names by p l a c i n g t h e m o u s e p o i n t e r wherever required. This behavior will work only in Developer Mode which means that the T ally Application must have started with a Command Line Parameter /Dev Mode. As seen in the following screen capture, the Field Name is displayed as a To o l t i p, when the cursor is pointed on the desired field within the Report. Figure 7. Field Name displayed as T ooltip when cursor points to a Field In the next screen capture, it can be seen that the Report Name is displayed as a T ooltip, when the cursor is not pointed on any of the fields within the Repor t. Figure 8. Report Name displayed when the cursor does not point on a Field
TDL_Reference_Manual.pdf
TDL_Reference_Manual.pdf
417 What's New in Release 4. 5 Introduction The TDL language is enriched with new capabilities, based on em erging needs, from time to time. With the introduction of the new product T ally. Server 9, in thi s release, a few generic actions and functions have been introduced. 1. Platform Functions 1. 1 Function-$$Is Accounting Vch This function checks if the specified voucher type is Accountin g Voucher or not. It returns a logical value. Syntax $$Is Accounting Vch : <Voucher Type Name> Where, <V oucher T ype Name> is the name of the voucher type. Example: Set As : $$Is Accounting Vch : ##TSPLSmp_Information 1. 2 Function-$$Is Inv Vch This function checks if the specified voucher type is Inventory voucher or not (excluding Order vouchers). It returns a logical value. Syntax $$Is Inv Vch : <Voucher Type Name> Where, <V oucher T ype Name> is the name of the voucher type. Example: Set As : $$Is Inv Vch : ##TSPLSmp_Information 1. 3 Function-$$Is Payroll Vch This function is used to check if the specified voucher type is Payroll Voucher or not. It returns a logical value. Syntax $$Is Payroll Vch : <Voucher Type Name> Where, <V oucher T ype Name> is the name of the voucher type.
TDL_Reference_Manual.pdf
What's New in Release 4. 5 418 Example: Set As : $$Is Payroll Vch : ##TSPLSmp_Information 1. 4 Function-$$Is Order Vch This functions is used to check if the specified voucher type i s Order Voucher or not. It returns a logical value. Syntax $$Is Order Vch : <Voucher Type Name> Where, <V oucher T ype Name> is the name of the voucher type. Example: Set As : $$Is Order Vch : ##TSPLSmp_Information 1. 5 Function-$$Is Prod T ally Server This function is used to check whether the product is T ally. Ser ver 9 or not. It returns TRUE if the product is T ally. Server 9. Syntax $$Is Prod Tally Server Example: [Function : TSPL Smp Is Prod Tally Server] 00 : If : $$Is Prod Tally Server 10 : Msg Box : "Server Check" : "The Current Product \n is Tally Server" 20 : ELSE : 30 : MSGBOX : "Server Check" : "The Current Product\n is not Tally Server" 40 : ENDIF 1. 6 Function-$$Excel Info This function is used to get the Excel 'version' and to check w hether 'XLSX' format is supported. Syntax $$Excel Info : <Keyword> Where, <Keyword> can be Is XLSXSupported or Version. The keyword Is XLSXSupported returns TRUE, if the format “xlsx” is supported, while Version returns the Excel version number. Example: Set As : $$Excel Info : Is XLSXSupported
TDL_Reference_Manual.pdf
What's New in Release 4. 5 41 9 1. 7 Function-$$Is Service Running This function is used to check if the specified service is runn ing or not. It returns TRUE if the service is running. Syntax $$Is Service Running : <Service Name> Where, <Service Name> can be any expression which evaluates to the name of the servic e. Example: [Function : TSPL Smp Is Service Running] 00 : If : $$Is Service Running : "Tally. Server 9" 10 : MSG Box : "Service Check" : "The Current Service \n is Running" 20 : ELSE: 30 : MSGBOX : "Service Check " : "The Current Service \n is not Running" 40 : ENDIF 1. 8 Function-$$Is Service Installed This function is used to check if the specified service is inst alled on the system or not. It returns TRUE if the service is installed. Syntax $$Is Service Installed : <Service Name> Where, <Service Name> can be any expression, which evaluates to the name of the servi ce. Example: [Function : TSPL Smp Is Service Running] 00 : If : $$Is Service Installed : "App Mgmt" 10 : Msg Box : "Service Check" : "The Current Service \n is installed" 20 : ELSE : 30 : MSGBOX : "Service Check" : "The Current Service \n is not Installed" 40 : ENDIF 1. 9 Function-$$Read INI The function is used to read the INI file, and get the value of any parameter in the INI. Syntax $$Read INI : <Path\File Name> : <Section Name> : <Parameter> [: <Index>]
TDL_Reference_Manual.pdf
What's New in Release 4. 5 420 Where, <Path\File Name> is the filename of the INI file, along with the path. <Section Name> is the section name in the INI file. <Parameter> is the Parameter whose value is to be fetched from the INI. <Index> is an optional parameter. It can be used when multiple values for the same parameter are accepted. Example: Set As : $$Read INI : “C:\Tally. ERP9\tally. ini”:”TALLY”:”User TDL” 1. 10 Function-$$Is User Allowed This function verifies and returns TRUE if user is allowed to p erform the specified operation on current T ally. Server9. Syntax $$Is User Allowed : <Username> : <Operation> : <Tally Server Name> Where, <User Name> is the name of the user. <Operation> is the operation that the user wants to perform. This can be an y one of Back Up, Restore, Rewrite, Create Company, Split Company and Monitor T ool. <T ally Server Name> is the name of the T ally. Server 9 Example: Set as : $$Is User Allowed : $User_name1 : ”Restore” : ##Sv Tally Server 1. 11 Function-$$Is TSAuthorised This function checks if securi ty is enabled on the specified T a lly. Server 9. It returns TRUE if security is enabled, else it returns FALSE. Syntax $$Is TSAuthorised : <Tally Server Name> Where, <T ally Server Name> is the name of the T ally. Server 9. Example: [Function : TSPL Smp Is TSAuthorised] 00 : If : $$Is TSAuthorised : ##Sv Tally Server 10 : MSG Box : "Security Check" : "Security Control is Enabled" 20 : ELSE :30 : MSGBOX : "Secuirity Check " : "Security Control \n is not Enabled" 40 : ENDIF
TDL_Reference_Manual.pdf
What's New in Release 4. 5 42 1 1. 12 Function-$$TSPing Info This function is used to retrieve the information related to T a lly. Server 9 like License mode, Number of license subscription days left, etc. Syntax $$TSPing Info : <Tally Server> : <Keyword> Where, <T ally Server Name> is the name of the T ally Server. <Keyword> can be any one of the keywords-Iseducational, License Expiry Day s Left and Has INFO. Has INFO returns TRUE or FALSE depending on whether the client is able t o get information for this T ally. Server 9 (otherwise Iseducational an d License Expiry Days Left fail in a TDL expression). Iseducational returns TRUE if the T ally. Server 9 is running in Educational mo de. License Expiry Days Left returns the number of subscription days remaining. Example: Set As : $$TSPing Info : ##Sv Tally Server : ##Ping_Operation 1. 13 Function-$$Is TSCompany This function checks whether the current company is opened thro ugh T ally. Server 9 or not. It returns a logical value. Syntax $$Is TSCompany : <Company Name> Where, <Company Name> is the name of the company. Example: Set As : $$Is TSCompany : $Company Storage 1. 14 Function-$$Selected Non TSCmps This function returns the total number of companies which are n ot loaded via T ally server, i. e., companies from local or shared data folders. Syntax $$Selected Non Ts Cmps Example: [Function : TSPL Smp Is Prod Tally Server] 00 : If : $$Selected Non Ts Cmps 10 : Msg Box : "Company Check" : $$Selected Non TSCmps;+ "Total Companies not loaded via Tally server is \n"
TDL_Reference_Manual.pdf
What's New in Release 4. 5 422 20 : ELSE: 30 : MSGBOX : " Company Check " : "All Companies Have been + Opened Via Tally Server " 40 : ENDIF 1. 15 Function-$$Is TSPath This function checks whether the given path is T ally. Server pat h or not. Syntax $$Is TSPath : <Path> Where, <Path> is any expression, which evaluates to a T ally Server Name or a Data Location Name. Example: Set As : $$Is TSPath : ”Data1:” 2. Action Enhancements 2. 1 Action-Disconnect User This action is used to disconnect the users from companies that are accessed from T ally. Server9. It will display a warning message to the clients to close the comp any within 2 minutes, before forcing a close. Syntax Disconnect User : <Tally Server Name> : <Company Name> : <User Name> Where, <T ally Server Name> is the name of the T ally. Server9, from which the companies are being accessed. <Company Name> is the name of the company to be disconnected. '*' can be used to specify all companies. <User Name> is the name of the user to be disconnected from the company spe cified. '*' can be used to specify all the users across companies. Example: Action : Disconnect User : "Ho Server" : * : "abc@abc. com" 2. 2 Action-Force Disconnect User It is used to forcefully disconnec t users from companies that a re accessed from T ally. Server 9. Syntax Force Disconnect User : <Tally Server Name> : <Company Name> : <User Name>
TDL_Reference_Manual.pdf
What's New in Release 4. 5 42 3 Where, <T ally Server Name> is the name of the T ally. Server from which the companies are be ing accessed. <Company Name> is the name of the company to be disconnected. '*' can be used to indicate 'all companies'. <User Name> is the name of the user to be disconnected from the company spe cified. '*' can be used to indicate 'all users across companies'. Example: Action : Force Disconnect User : "Ho Server" : * : "abc@abc. com" 2. 3 Action-Start Service This action is used to start the specified service. Syntax Start Service : <Service Name> Where, <Service Name> can be any expression which evaluates to the name of the servic e. Example: Action : Start Service : "Tally. Server 9-1" 2. 4 Action-Stop Service This action is used to stop the specified service. Syntax Stop Service : <Service Name> Where, <Service Name> can be any expression which evaluates to the name of the servic e. Example: Action : Stop Service : "Tally. Server 9-1" 2. 5 Action-Write INI This action is used to Add/Alter the value of any parameter in the specified INI file. Syntax Write INI : <Path\File Name> : <Section Name> : <Parameter> : [<Value> : [:<Index>]] Where, <Path\File Name> is the path and filename of the INI file <Section Name> is the section name in the INI file <Parameter> is the name of the parameter whose value is to be set in the IN I.
TDL_Reference_Manual.pdf
What's New in Release 4. 5 424 <Value> is the value to be set for the given parameter. In the absence of any value, the existing value will be removed. <Index> is an optional parameter. It can be used when multiple values are accepted for the same parameter. In the absence of the index parameter, the value of the last index will be updated. Example: Action : Write INI : “C: \Tally. ERP9\tally. ini” : ”TALLY” : ”User TDL” : ”Yes”
TDL_Reference_Manual.pdf
425 What's New in Release 3. 62 1. Multiple Orientation Support for Printing Currently, T ally supports printing of multiple forms within a single repo rt in single orientation only, i. e., all the forms within a report can be printed either in Portrai t or in Landscape format only, as specified in the report. In order to support printing of multiple forms within a single report in different orientations, the behaviour of V ariable SVPrint Orientation has been enhanced. T o achieve this behaviour, the local declaration of the V ariable 'SVPrint Orientation' at 'Report' level is mandatory, and its value must be set using the form level attribute 'Set Always' in individual forms. This will be very useful in scenarios where multiple forms are being printed from a single report. For example, from a Payment Voucher, one needs to print both Voucher and Payment Advice. However, the Payment Voucher needs to be printed in 'Portrait' form, an d the Payment Advice in 'Landscape'. Example: [Report : TSPL Smp Var SVPrint Orientation Extended] Form : TSPLSmp Var SVPrint Orientation Frm + TSPLSmp Var SVPrint Orientation Frm2 ;; Mandatory Local declaration of Variable SV Print Orientation Variable : SV Print Orientation : String [Form : TSPL Smp Var SVPrint Orientation Frm1] ;; Orientation of this Form is set to 'Portrait' Set Always : SV Print Orientation : "Portrait" [Form : TSPL Smp Var SVPrint Orientation Frm2] Use : TSPL Smp Var SVPrint Orientation Frm1 ;; Orientation of this Form is set to 'Landscape' Set Always : SV Print Orientation : "Landscape" In this example, the report ' TSPLSmp Var SVPrint Orientation Extended ' has two forms, viz. TSPLSmp Var SVPrint Orientation Frm1 and TSPLSmp Var SVPrint Orientation Frm2. Based on the value set to the variable 'SV Print Orientation', both the forms are being printed in the respective orientation.
TDL_Reference_Manual.pdf
TDL_Reference_Manual.pdf
427 What's New in Release 3. 61 1. Action Enhancements 1. 1 Action-Browse URL Ex As we are aware, there is an action Browse URL/Execute Command used to open a web page or invoke an external application. There may be cases where sub sequent actions are dependent on the completion of the previous action, i. e., the closure of external application. For example, the current action is used to execute an external file, which unzip s/ extracts various other files. The subsequent actions use these extracted files to process further. I n s u c h c a s e s, Browse URL, when used, will trigger the requested application and continue executing the subsequent actions. Hence, in order to bring sync between the calling and the calle d application, a new action Browse URL Ex/Execute Command Ex has been introduced. The Action Browse URL Ex, when triggered, waits till the external application is closed, and t hen allows the application to resume with the subsequent action. Similar to 'Browse URL', the Action 'Bro wse URL Ex' can be used to: Open a web Page in the browser Open an external file with its associated application Run an executable application Open a folder in explorer Syntax Browse URL Ex : <URL/File path/executable file path/folder path> + [:<Command line Parameters>] Where, <URL/File path/executable file path> can be: A URL, which can be opened in a browser A file, which is to be opened with its associated application An executable file, which is to be run/executed A folder, which is to be opened in the explorer <Command line Parameters> is an optional parameter. For example, Zip application may need parameter d to decompress, c to compress, etc. Browse URLEx is useful for URL, folder and executable without extension (e. g., tally instead of tally. exe), and it has similar behaviour as Browse URL.
TDL_Reference_Manual.pdf
What's New in Release 3. 61 428 Example:1 T o open a URL in browser: Action : Browse URL Ex : “http://google. com” Example:2T o open a pdf file in pdf reader: Action : Browse URL Ex : “C:report. pdf\” In this example, report. pdf will be opened in default PDF reade r of the system. This can be useful while reading a report, which is exported in PDF format. Example:3T o open an executable file and wait for it to complete: Action : Browse URL Ex: “C:\7zip. exe”: “d software. 7z” In this example, 7zip is opened and the application waits until it finishes, i. e., the running application first waits for 7zip. exe to finish decompressing of software. 7z, and then it proceeds further. Example:4 T o open a folder: Action : Browse URL Ex : “C: \abc” 2. Function Enhancements 2. 1 Function-$$File Read Raw We have a function $$File Read to read the contents from a text file, which was designed to ignore quotes, comments, spaces, etc., while reading the entire line. Now, a new function $$File Read Raw has been introduced, similar to the Function $$File Read, except that the Function $$File Read Raw can read lines with: Quotes Comment characters (; /* */) Spaces & T abs Syntax $$File Read Raw[:<Number>] Where, <Number> denotes the number of characters to be read. Example: [Function : Test File Read Raw] Variable : Get Path : String Variable : Get_Down Load_File Line : String
TDL_Reference_Manual.pdf
What's New in Release 3. 61 42 9 000 : Set : Get Path : "C:\Text Source. txt" 010 : Open File : ##Get Path : Text : Read 020 : While : (TRUE) 030 : Set : Get_Down Load_File Line : $$File Read Raw Using this function, we can read lines with quotes, comment cha racters, spaces, tabs, etc. I f $$File Read Raw is specified with parameter, the behaviour is same as that of Function $$File Read. If specified without parameters, the entire line is read witho ut ignoring quotes, spaces, etc.
TDL_Reference_Manual.pdf
TDL_Reference_Manual.pdf
431 What's New in Release 3. 6 1. Collection Enhancements 1. 1 New methods Last Modified Dat e and Last Modified Time for File Properties In 'Collection' definition, Directory as a Data Source was supported in Release 3. 0, where the properties of the file, i. e., Name, File Size, Is Directory, Is Read Only and Is Hidden, were supported as the Methods. In Release 3. 6, two new methods called Last Modified Date and Last Modified Time have been introduced, to extract additional file properties in Ta l l y. This can be very useful in Integration scenarios with T ally usi ng external Files. The last imported date and time can be validated against the Last Modified Date a nd Time of the File prior to importing from the file. Method-$Last Modified Date $Last Modified Date-It returns the date on which the file was last altered. The f ormat supported is dd-mm-yyyy. Syntax $Last Modified Date Example: [Collection : Listof Files] Data Source : Directory : "C:\" Format : $Name, 25 Format : $File Size, 15Format : $Is Read Only, 15 Format : $Last Modified Date, 15 Here, $Last Modified Date will retu rn the date on which the file was last modified, e. g., 27-May-2012 Method-$Last Modified Time $Last Modified Time-It returns the time at which the file was last altered. The f ormat supported is hh:mm:ss (24 hours) Syntax $Last Modified Time
TDL_Reference_Manual.pdf
What's New in Release 3. 6 432 Example: [Collection : Listof Files] Data Source : Directory : "C:\" Format : $Name, 25 Format : $File Size, 15Format : $Is Read Only, 15 Format : $Last Modified Date, 15 Format : $Last Modified Time, 15 Here, $Last Modified Time will retu rn the time at which the file was last modified, e. g., 16:28:18 Following screen capture displays the last modified date and th e last modified time in the table: Figure 1. File properties cont aining Last Modi fied Date and L ast Modified Time 2. Action Enhancements 2. 1 Action-Execute TDL TDL action Execute TDL has been introduced to programmati cally load TDL, perform some actions and subsequently, unload the TDL or keep the TDL loaded for the current T ally se ssion. This can prove to be very useful in cases where the user needs to programmatically associate a TDL on the fly, for performing some operations. Syntax EXECUTE TDL : <TDL/TCP File Path>[: <Keep TDL Loaded Flag> : + <Action>: <Action Parameters>] Where, <TDL/TCP File Path> specifies the path of the TDL/TCP File to be loaded dynamically. <Keep TDL Loaded Flag> is the Logical Flag to determine if the TDL should be kept load ed after the action is executed. If the value is set to YES, then the TDL will continue to be loaded, else the Executed TDL will be unloaded after the execution of the specif ied action. <Action> specifies the global Action to be performed, i. e., Display, Alter, Call, etc.
TDL_Reference_Manual.pdf
What's New in Release 3. 6 43 3 <Action Parameters> are the parameters on which the Action is performed. For exampl e: If the action is Call, the Action Parameters contain the Function name along with the Function Parameters, if any. If the Action is Display, Alter, etc., then the Parameter should be the Report Name. Example: 1 [Function : TDL Execution with Keep TDL Loaded enabled] 00 : Execute TDL : "C:\Tally. ERP9\BSTitle Change. TDL" :+ Yes : Display : Balance Sheet 10 : Display : Balance Sheet The file BSTitle Change. TDL contains the following lines of code: [#Report : Balance Sheet] Title : "TDL Executed Programmatically" In this example, the TDL BSTitle Change. TDL, which is used to change the T itle of the report Balance Sheet, is loaded dynamically by executing the action 'E xecute TDL'. T h e Keep TDL Loaded Flag is set to YES in the above code snippet. Based on the subsequent action Display: Balance Sheet, the Balance Sheet report will be shown with a new Title. The next statement also displays the Balance sheet. The ti tle for this will again be th e same, i. e., the changed title, as the dynamic TDL is still loaded, even after the action 'Execute TDL ' has completed its execution. Example: 2 [Function : TDL Execution with Keep TDL Loaded enabled] 00 : Execute TDL : "C:\Tally. ERP9\BSTitle Change. TDL" : No + : Display : Balance Sheet 10 : Display : Balance Sheet Here, the report Balance Sheet would be displayed twice and the title of the first report is “ TDL Executed Programmatically”, i. e., the changed title as per BSTitle Change. TDL ; whereas, in the second report, the title is Balance sheet, since the attribute Keep TDL Loaded Flag is set to NO. 3. Platform Functions and Variables 3. 1 Function-$$Printer Info Function $$Printer Info has been introduced to extract the settings information for any installed printer. This function is very useful to get the information of the pri nter, based on which, we can determine the dimensions for pre-printed invoice, etc. Syntax $$Printer Info : <Printer Name> : <Information Type> Where, <Printer Name> refers to the name of the printer for which the information is required.
TDL_Reference_Manual.pdf
What's New in Release 3. 6 434 <Information T ypes> are permissible information types like Print Sizein Inches, Left M argin In MMs, etc. Example: $$Printer Info : HPLaser Jet4250PCL6 : Print Size In Inches The list of permissible Information Types are: Left Margin In MMs returns the Number which denotes the space to be left on the Le ft side of the page in Millimeters. T op Margin In MMs returns the Number which denotes the space to be left on the T o p of the page in Millimeters. Right Margin In MMs returns the Number which denotes the space to be left on the R ight side of the page in Millimeters. Printer Exists returns Logical value (YES/NO), indicating if the Printer Exist s or not. Print Size In Inches returns the dimensions which denotes the Print Area in Inches, i. e., excluding the Margins. Print Size In MMs returns the dimensions which denotes the Print Area in Millimet ers, i. e., excluding the Margins. Print Size In Lines returns the dimensions which denotes the Print Area in Lines, i. e., excluding the Margins. Paper Size In Inches returns the dimensions which denotes the Paper Size in Inches, which includes the Margins. Paper Size In MMs returns the dimensions which denotes the Paper Size in Millimet ers, which includes the Margins. Paper Size In Lines returns the dimensions which denotes the Paper Size in Lines, which includes the Margins. Paper T ype returns the selected Type of the Paper, e. g., A4, A5 Small, etc. Port Name returns the Port Name configured for the Printer. Orientation returns the Orientation Type of Paper, i. e., Landscape or Portrait. The following screen capture displays the selected Printer deta ils for all the information types:
TDL_Reference_Manual.pdf
What's New in Release 3. 6 43 5 Figure 2. Printer Details 3. 2 Function-$$Is Internet Active $$Is Internet Active is a function which helps to determine if the Internet is curre ntly active. It returns TRUE if the Internet is accessible, else returns FALSE. It can be used to perform conditional operations, i. e., based on the Internet Connectivit y, certain actions can be triggered. This function checks if the internet is active, such that the o perations pertaining to connecting to web pages, emailing, uploading files to FTP, etc., can be performed. Syntax $$Is Internet Active Example: [Function : Emailif Connected] 00 : IF : $$Is Internet Active ;; Function called to Email O/s Stmts 10 : Call : Email Outstanding Statements 20 : ENDIF In this example, the Outstanding Statements are E-Mailed, if Internet connectio n is present. 3. 3 Function-$$Case Convert Prior to this release, the function $$Upper has been used to convert the string expressions to upper case, but there were no functions available for other con versions like Lower case, Title Case, etc. T o overcome the difficulty of converting the string to Lo wer case, Title case, etc., a new function $$Case Convert has been introduced, to convert the case of the given expressio n to the specified case format. This function will return a string expre ssion in the converted format.
TDL_Reference_Manual.pdf
What's New in Release 3. 6 436 This function is very useful when one needs to follow the case rules to display the Name of the company, Name of the bank, etc. Syntax $$Case Convert : <Case Keyword> : <Expression> Where, <Case Keyword> can be All Capital, Upper Case, All Lower, Lower Case, Small Case, First Upper Case, Title Case, Title Case Exact, Normal, Proper Case, etc. All Capital/Upper Case converts the input expression to upper case. All Lower/Lower Case/Small Case converts the input expression to lower case. First Upper Case converts the first letter of the first word in a sentence to up per case. Other characters will remain as they are. Title Case converts the input expression to Title case, i. e., the principa l words should start with capital letters. It will not convert the prepositions, articles or conjunctions, unless one is the first word. It will ignore a subset of words from capitalization like the, an, and, at, by, to, in, of, for, on, cm, cms, mm, inch, inches, ft, x, dt, eis, dss, with, etc. For this subset of words, the original strings' cases will be preserved. Title Case Exact converts the input expression to Title case, i. e., the principal words will start with capital letters. It will not convert the prepositions, articles or conjunctions, unless one is the first word. It will ignore a subset of words from capitalization like the, an, and, at, by, to, in, of, for, on, cm, cms, mm, inch, inches, ft, x, dt, eis, dss, with, etc. This subset of words will be converted to small case. Proper Case converts the input expression to Title case, i. e., all the word s in a sentence should start with capital letters. Normal preserves the input expression as it is. <Expression> is any expression of type 'String'. Example: 1T o convert the expression to Upper case: [Field : String Convert] Set as : $$Case Convert:Upper Case : “Tally solutions Pvt. Ltd. ” In this example, the function returns “TALLY SOLUTIONS PVT. L TD. ” in the field 'String Convert'. Example: 2T o convert the expression to Lower case: [Field : String Convert] Set as : $$Case Convert : Lower Case : “Tally Solutions Pvt. Ltd. ” Here, the function returns, “tally solutions pvt. ltd. ” in the field 'String Convert'.
TDL_Reference_Manual.pdf
What's New in Release 3. 6 43 7 Example: 3 T o convert the expression to Title Case: [Field: String Convert] Set as : $$Case Convert : Title Case : + “To convert the stri Ng to Title case” Here, the function returns “T o Convert the Stri Ng to Title Case ” in the field 'String Convert'. Example: 4T o convert the expression to Title Case Exact: [Field : String Convert] Set as : $$Case Convert : Title Case Exact : + “To convert the string to Title case” Here, the function returns “T o Convert the String to Title Case ” in the field 'String Convert'. Example: 5 T o convert the expression to First upper case: [Field : String Convert] Set as : $$Case Convert:First Upper Case : “Tally solutions pvt. ltd. ” Here, the function returns “T ally solutions pvt. ltd. ” in the f ield 'String Convert'. 3. 4 Function-$$Random Number A random number is a number generated by a process whose outcom e is unpredictable, and which cannot be subsequently reliably reproduced. In other word s, Random numbers are numbers that occur in a sequence such that, the values are unif ormly distributed over a defined interval and it is impossible to predict future values based on past or present ones. In this release, a new TDL function $$Random Number has been introduced to generate Random Numbers. In case of auditing, this can be useful for audit ors who would like to pick up some vouchers randomly for authentication. Syntax $$Random Number[:<Min Range>[:<Max Range>]] Where, <Min Range> and <Max Range> are optional. In the absence of Max Range, Long Max is considered, i. e., (2^31)-1 = 2147483647. In the absence of Min Range, ZE RO(0) is considered. We can generate random numbers in different ways:No Parameters : Don't pass any parameters, i. e., just invoke $$Random Number. Default values are assumed. Only with the Min Range Parameter : Here, there is no need of passing Max range. In this scenario, Random number is generated from the given Min Range.
TDL_Reference_Manual.pdf
What's New in Release 3. 6 438 Both Max Range and Min Range as Parameter : In this scenario, random numbers are generated for given range. Example: 1With no Parameters Set As : $$Random Number This code will return a Random Number between 0 and 2147483647. Example: 2With Min Range Parameter only Set As : $$Random Number:9999 This code returns Random Numbers between 9999 and 2147483647, t he random number being greater than or equal to 9999. Here, value of Min Range is 9999 and Max Range is 2147483647. Example: 3 With both Parameters (Min Range and Max Range) Set As : $$Random Number : 9 : 9999This code returns Random Numbers between 9 and 9999. 3. 5 Variable-SV Print Orientation V ariable SVPrint Orientation has been introduced to set the required Printer Orientation, that is, Portrait or Landscape, within a Report. It is recommended to de clare a local variable within the function or report and set the variable value, to avoid the sys tem Printer Configuration changes to be effected globally. This is useful where a Report needs to printed in a different o rientation, e. g., Landscape. For e. g., if one needs to print the cheques in 'Landscape' mode and other re ports in 'Portrait' mode, then there is no need to keep switching the printer settings from Po rtrait to Landscape, and vice versa, based on the report getting printed. For Cheque Printing Report, one can default Landscape Orientation. Example: [#Report : Balance Sheet] ;; Local Variable Declaration Variable : SVPrint Orientation : String Set : SVPrint Orientation : “Landscape” Since the variable is locally declared and updated within the R eport Balance Sheet, the same will not affect the global printer settings.
TDL_Reference_Manual.pdf
439 What's New in Release 3. 0 In this release, the programmable configuration support has bee n extended to the actions 'Print Report', 'Export Report', 'Upl oad Report' and 'Email Report'. A new attribute Plain XML has been introduced at Report level to export the report in pla in XML format. New functions $$Str By Char Code and $$In Preview Mode have been introduced, whereas the functions $$Inwords and $$Context Keyword s have been enhanced. New events 'Start Import', 'Import Object' and 'End Import' have been intr oduced for 'Import File' definition. 1. Collection Enhancements 1. 1 Collection Attribute 'Walk Ex' Introduced With every release, performance improvements are being brought, especially with respect to the data gathering and processing artefact 'Collection', used to ga ther and deliver data to presentation layers. Performance is enhanced drastically if collection is ga thered judiciously as per usage. Sometime back, the Collection attribute 'Keep Source' had been introduced for performance enhancement. This was used to retain the source collection gathered once wi t h t h e s p e c i f i e d Interface Object, i. e., either with the current Object or its p arents/owners. It drastically improved the performance in scenarios where the same source collection w as referred multiple times within the same Object hierarchy chain. Similarly, there are scenarios where there is Union of multiple collectio ns using the same source collection, and each collection walks over its sub objects acro ss different paths, and computes/ aggregates the values from sub level. In such cases, significan t CPU cycles will be utilized in gathering and walking over the same Source Object along differe nt paths more than once. A new attribute Walk Ex has been introduced, which when specifie d in the resultant collection, allows us to specify a collection list. The source collection s pecification is available in the resultant collection. The collections referred in Walk Ex do not have any source collection specified and contain attributes only to walk the source collection and aggre gate over Sub Objects of an already gathered collection. The advantage of using Walk Ex is that all walk paths specified in the collection list are traversed in a single pass for each object in the source collection. This results in improvements in performance drastically. Collection Attribute-Walk Ex Syntax [Collection : <Collection Name>] Walk Ex : <Collection Name1>, <Collection Name2>,.. Where, <Collection Name1>, <Collection Name2>, and so on, are the collection names specifying Walk and aggregation/computation attributes.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 440 Example: The requirement here is to generate a Report displaying Item Wi se and Ledger Wise amount totals for all Vouchers. Using the Union Approach ;;The source collection “Voucher Source” is a Collection of Vouchers [Collection : Voucher Source] Type : Voucher ;;The collection using “Voucher Source” as a sour ce collection, and walking over Ledger Entries Sub-Object, aggregating Amount by grouping over Ledger Name [Collection : Ledger Details] Source Collection : Voucher Source Walk : All Ledger Entries By: Particulars : $Ledger Name Aggr Compute : Tot Amount : Sum: $Amount Keep Source : (). ;;The collection using Voucher Source as a source collection, and walking over Inventory Entries Sub-Object, aggregating Amount by grouping over Stock Item Name [Collection : Stock Item Details] Source Collection : Voucher Source Walk : All Inventory Entries By : Particulars: $Stock Item Name Aggr Compute : Tot Amount : Sum: $Amount Keep Source : (). ;;The Resultant Collection, which is a union of objects from the above two collections “Ledger Details” and “Stock Item Details” [Collection : Union Led Stk Vouchers] Collection : Ledger Details, Stock Item Details In this example, both the collections 'Ledger Details' and 'Stock Item Details' are using the same Collection 'Voucher Source'. We can observe that while gatherin g and summarizing values from the source collection, each object of the collection 'Voucher S ource' is traversed twice for aggregating objects over two different paths, i. e., once for 'L edger Entries' and then for 'Inventory Entries'. The report finally uses the Union collection 'Union L ed Stk Vouchers' to render the same.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 44 1 Let us now move on to the new approach using “Walk Ex” to achiev e the same Using the Walk Ex Approach ;;The source collection “Voucher Source” is a Collection of Vouchers [Collection : Voucher Source] Type : Voucher /* The collection “Union Led Stk Vouchers” is the result ant collection which will contain all the Objects obtained out of walks and multiple walks over the same Source Collection. The Report finally uses this Collection. The attribute Walk Ex is specified which has values as collection names “Ledger Details” and “Stock Item Details”*/ [Collection : Union Led Stk Vouchers] Source Collection : Voucher Source Walk Ex : Ledger Details, Stock Item Details Keep Source : (). /*The Collection “Ledger Details” walks over “All Ledger Entries” Sub-Objects and aggregates the amount by grouping over Ledger Name. Note the absence of source collection. */ [Collection : Ledger Details] Walk : All Ledger Entries By : Vch Stock Item : $Ledger Name Aggr Compute : Vch Led Amount : Sum: $Amount /*The Collection “Stock Item Details” walks over “All Inventory Entries” Sub-Objects and aggregates the amount by grouping over Stock Item Name. Note the absence of Source Collection in this. */ [Collection : Stock Item Details] Walk : All Inventory Entries By : Vch Stock Item : $Stock Item Name Aggr Compute : Vch Led Amount : Sum : $Amount The Collections used within 'Walk Ex' use the same Source Collec tion. Each Object of “Voucher Source” is walked across “Ledger Entries” and “Inventory Entrie s” in a single pass. Thus, there is an exponential improvement in performance as it traverses each object only once, to gather the values for the resultant collection. In the case of Union Colle ction, for every Collection using different walk path, the Source Collection Object is being trav ersed again and again. 'Walk Ex' Attribute-Usage Implications Let us consider the following code design, to understand the implication on various other collection attributes, in cases where 'Walk Ex' is used.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 442 [Collection : Src Coll] ;; Source Collection... ;;Resultant Collection “Res Coll” is using the Source Collection “Src Coll”, and Walk Ex Collections “Walk Ex Coll 1” and “Walk Ex Coll 2” are specified [Collection : Res Coll] Source Collection : Src Coll Walk Ex : Walk Ex Coll 1, Walk Ex Coll 2 [Collection : Walk Ex Coll 1] ;;Walk Ex Coll 1 Walk : Path1, Sub Path1, Sub Sub Path1 By : Group Name1 : $Method1 [Collection : Walk Ex Coll 2] ;;Walk Ex Coll 2 Walk : Path2, Sub Path2, Sub Sub Path2 By : Group Name2 : $Method2 The following table shows the attributes of 'Collection' defini tion and their applicability in the Resultant collection as well as Walk Ex collections. Attributes Resultant Collection Walk Ex-Collections Source Collection Specified and applicable Ignored Keep Source Specified and applicable No significance Is Client Only Specified and Considered Ignored Sorting Specified and applicable Ignored Filtering Specified and applicable Ignored Max Specified and applicable No significance Parm Var Specified and Considered Ignored but to be inherited from the resultant collection Source Var Specified and Considered Specified and applicable Compute\Filter Var Specified and applicable Specified and applicable Fetch Specified and applicable Specified and applicable Compute Specified and applicable Specified and applicable Aggr Compute No significance Specified and applicable Walk\By If Specified these two attributes Walk Ex will be ignored Specified and applicable
TDL_Reference_Manual.pdf
What's New in Release 3. 0 44 3 1. 2 Directory as a Data Source As we are already aware, a collection can be populated dynamically using the data avail able from a variety of external data sources. A common attribute 'Data Sour ce' is used to specify the Type and identity of the source from where the data is to be retriev ed. Thereafter, the data is available as objects and the associated information can be extracted from them using the corresponding methods. For example, if the data is populated from an XML file, the tag names are r eferred to as the method names. In case the data is populated from a compound variable, the corresponding member variable names are referred to as method names. Prior to this release, the Data Sources supported were: XML available over HTTP/HTTPS using Post/Get methods XML File available within the local disk or over a network Output XML from an External DLL Specific Objects from Current/Parent Report Va r i a b l e Syntax Data Source : <Type> : <Identity> [:<Encoding>] Where, <T ype> specifies the type of data source: File Xml/HTTP Xml/Report/Par ent Report/DLL/V ariable <Identity> can be file path, scope, etc., depending on the type specificat ion. <Encoding> can be ASCII or UNICODE. This is Optional. The default value is UNICODE. From release 3. 0 onwards, the collection attribute Data Source has been enhanced to support “Directory” as data source type. This will enable to gather all information pertaining to the contents of the disk directory/folder. Each folder constituent, i. e., either File or Directory, along with its corresponding details, are available as an object in t he collection. Let us consider the directory/folder “ABC”, as shown in the fol lowing figure: Figure 1. Folder path The folder contains two files “a. txt” and “b. txt” and the folder “abcsub”. In order to retrieve the item details along with the corresponding information like type, siz e and date modified within a collection, the attribute 'Data Source' can be specified with t he new enhanced syntax as: Syntax [Collection : <Collection Name>] Data Source : <Type> : <Identity> [:<Encoding>]
TDL_Reference_Manual.pdf
What's New in Release 3. 0 444 Where, <Collection Name> is the name of the collection where the data is populated as ob jects. <T ype> specifies the type of data source. As per the new enhancement, it is “Directory”. <Identity> is the Directory/folder Path, when the type specified is 'Directory' <Encoding> can be ignored for Type “Directory”. The following code will populate the collection “ABC Contents” with the folder contents from the path “C:\ABC”. In this case, each of the items, i. e., a. txt, b. txt and “abcsub”, will be available as separate objects of the collection. The related information per taining to each object will be available as methods $name, $filesize, $Is Directory, $Is Read Only, $Is Hidden, etc. [Collection : ABC Contents] Data Source : Directory : "C: \ABC" 2. Image Printing Capabilities Over the years, there has been a major requirement from the use r community to enable Image Printing in T ally. Earlier, we used to achieve this capability by creating a new Font Type by associating an Image with a parti cular character and further us ing the 'Style' for the field. This had a few limitations in terms of image size, resolution and color. Also, it was not a clean way of incorporating the feature. From this release onwards, Image Printing is being supported wi th the help of the following latest enhancements: 'Graph Type' attribute of Part allowing the specification of BM P, enabled for ' Print ' Mode A new Definition Type ' Resource ' introduced in TDL The configuration settings allow the user to specify the locati on of the Image file and the same is printed as a logo on the top left of the following default Repo rts. Sales Invoice-both Normal and Simple formats Delivery Note/Challan Debit Note Credit Note Outstanding Receivables Remainder Letters Pay Slips Purchase Order Receipt voucher$filesize is applicable only if the object is of type FILE.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 44 5 Confirmation of Accounts 2. 1 Part Attribute-Graph T ype Prior to T ally. ERP 9 release 3. 0, specification of Image (as BMP only) within a part was support ed. The attribute Graph T ype of the part is used for the same. Syntax [Part : Part Name] ... Graph Type : Yes/Bitmap Image Path Where, <Graph T ype> accepts 'Yes', or a path of the bmp file. If the value of <Graph Type> is “Yes”, then it will be treated as a graph. If the value is not “Yes”, then system will look for a Bitmap file with the given expression. However, the bitmap image was only supported in the 'Display' Mode. From this Release onwards, this capability has been extended to 'Print' mode also. A few points are to be considered: The attribute 'Graph Type' supports Bitmap and JPG/JPEG. If the image type is specified as a JPEG/JPG, it will consume the same. If it is of any other type, this wil l be considered as BMP and the same will be located from the path specified. If the file is unavailable or is not a valid image file, then the area allocated for image will be blank. The Part containing 'Graph Type' cannot display or print any co ntents and any contents specified within the fields wil l be ignored. That's why it requ ires the specification of dummy lines and fields within the part. Part Height and Width must be apportioned appropriately as per the Image size to be printed [If the height and/or width is not given, then the system will take the actual image size and use the same for display]. If the user has specified H eight and/or width which is different from actual image size, then the system will do propo rtionate resizing of the image to fit into the given area [For example, let's say that area allocated for the image is 300 X 300 and actual image size is 150 X 75. Then, the system will display image in 300 X 150]. 2. 2 New Definition T ype-Resource A new definition type “Resource” has been introduced in TDL. Th is will allow accessing and using the resources (images, icons, cursors, etc. ) from a local disk, HTTP/FTP or from a DLL/EXE. The image formats supported at pre sent are BMP/JPEG/ICON/CUR. The re source thus created can be used in a 'Part' definition using the attribute “Image”. Thi s is applicable both in 'Print' and 'Display' mode. Syntax However, when the same report is exported in PDF, only BMP and JPEG are sup-ported. Other file formats will be ignored.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 446 [Resource : Name] Source : <Path to Image file> Resource : <Name Of Resource> [:<DLL/EXE Name with path>] Resource Type : Bitmap/Icon/Jpeg/Cursor Attributes-SOURCE, RESOURCE and RESOURCE TYPE Attribute-SOURCE This is a 'Single' type attribute, and hence accepts only one p arameter. It allows us to specify the image file path. This file can be a local disk file, or a file available over an HTTP/FTP path. Syntax Source : <Path to Image file> Where, <Path to Image file> can be any string expression which evaluates to the file path, along with Filename and extension. Example:1 [Resource : Cmp Image] Source : “C: \Tally. bmp” ;; where the image “T ally. bmp ” is available in local disk Example:2 [Resource : Cmp Image] Source : “H ttp://www. tallysolutions. com/images/tally HTTP. JPEG” ;; where the image tally HTTP. JPEG is available over an HTTP Path Attribute-RESOURCE This is a 'Dual' type attribute and accepts two parameters. The first parameter refers to the resource name present in an Exe/DLL. The second parameter is us ed to specify the path and the name of Exe/DLL. However, this is optional. In case not specified, the system will look for the resource within tally. exe itself. Syntax Resource : <Name Of Resource> [:<DLL/EXE Name with path>] Where, <Name of Resource> is a string expression which evaluates to the name of the resou rce present in the specified DLL/EXE (When resources are added to DLL/EXE, the user can give a separate name for the resource). <DLL/EXE Name with path> can be a string which evaluates to the complete DLL/EXE path. Example:1 [Resource : Cmp Image] Resource : “TITLEICON”
TDL_Reference_Manual.pdf
What's New in Release 3. 0 44 7 ;; This uses the resource “TITLEICON” present in T ally exe, as we have not specified the EXE path. Example:2 [Resource : Cmp Image] Resource : "60040" : C:\Program Files \Windows NT + \Accessories\wordpad. exe Resource Type : BMP ;; This uses the resource "60040" present in the word pad. exe, as we have spec ified the EXE path as the second parameter. Attribute-RESOURCE TYPE This is a 'Single' type attribut e, and hence accepts only one v alue as a parameter. It allows the specification of Type of the resource. 'Type' can be any one of the standard windows image resources like Bitmap, Icon, Cursor or JPEG. The type specified in 'Resource Type' will be used for loading the image appropriately. 'Resource Type' is a mandatory attribute and must be specified for all sources. If not specified, the type would taken as 'Bitmap' by default. Syntax Resource Type: BMP/Icon/Jpeg/Cursor Example: [Resource : Cmp Image] Source : “C: \Tally. bmp” Resource Type : BMP Part Attribute-Image Part Attribute-IMAGE With the introduction of the new attribute “Image”, it is possi ble for the resource created by using the Definition “Resource” to be used in the Part. Syntax [Part : Part Name] ... The attribute “Source” and “Resource” are mutually exclusive, i. e., either of them can be used. We cannot use both together. If both are specified in TDL, then thesystem will use SOURCE and igno re the RESOURCE attribute. For the Icon resources-th e nearest sized Icon will be taken. For example, if we have two Icons 16X16 and 32X32 and the part size is 20X20, then the 16X16 icon will be used for displaying.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 448 Image : <Resource Name> Where, <Resource Name> is the name of the Resource definition. Example: [Part : Part ABC] Image : Cmp Image 3. Enhanced Columnar Capability 3. 1 Columnar Reports in General A matrix report looks like a grid. It contains a row of labels, a column of labels, and information in grid format that is related to both the row and column labels. In T ally, two dimensional matrix reports can be designed using the Auto column report approach ( using Repeat V ariables). Traditionally, these types of Reports are referred to as columnar Reports. In particular, Matrix report is a variant of automatic auto column reports, where the columns are repeated over a variable associated at the Report. The collection repeated with this variable is used to populate the repeated values into the variable. The method value in the detail line i s extracted from a different collection, based on the corresponding row and column indexes. Following is a typical two-dimens ional matrix report showing th e total number of stock items sold for each party. Figure 2. Two-dimens ional matrix report 3. 2 Enhanced Capabilities for Columnar Reporting The latest enhancements in the area of Columnar Reporting enabl es us to design the reports using a new approach altogether. A field within a line can display method values from multiple objects of the collection. Context Free repeat within the part and line enable repetition on simple as well as list variable values. These features give a better c ontrol in the hands of the programmer These features give a better control in the hands of the progra mmer in designing such reports. If we consider the above report layout, the labels in columns c an now repeat over a collection of Parties. The data in the cells can be populated based on the co mbination of row and column label values across the dimensions. In the previous table, for exampl e, the highlighted cell contains the value of total sales quantity corresponding to the party “Party 2” for the Stock Item “Stock Item 2”. The following enhancements have been enabled to achieve this fu nctionality: 'Repeat' Attribute for Part and Line over a Collection
TDL_Reference_Manual.pdf
What's New in Release 3. 0 44 9 Context Free Repeat for Part and Line, together with SET/Break On Usage of the function $$Line Object Attribute 'Repeat' Enhancements-Part and Line The 'Repeat' Attribute has been enhanced consistently across 'P art' and 'Line' Definitions to support “Context Based” as well as “Context Free” Repeat. Attribute REPEA T-Part Definition The common syntax allows the repetition of a contained line, wi th or without a collection. Syntax [Part : <Part Name>] Repeat : <Line Name> [: <Collection>] Set : <Count> Where, <Part Name> is the name of the part. <Line Name> is the name of the line to be repeated. <Collection> is the name of collection on which the line is repeated. It is an optional parameter. <Count> denotes the number of times the line is to be repeated, if Coll ection Name is not specified. Context based Repeat-The 'Repeat' attribute of the Part can repeat the contained l ine over a collection. Each line in this case is associated with each obje ct of the collection. This was the earlier capability even before T ally. ERP 9 Context Free Repeat-From Release 1. 8, the Collection parameter in the above synta x has been made optional. This allows the repetition of a contained l ine without a collection. Since the no. of times the line has to be repeated is not known, the usag e of the attribute SET to specify the count becomes mandatory. In case of 'Edit' mode, the attribute 'Break On' can be used t o specify the terminating condition for repetition. Attribute REPEA T-Line Definition So far, the 'Repeat' attribute at 'Line' definition has been ac cepting only a field name which internally uses the repeat behaviour of the Report and V ariable for determining the no. of times it can be repeated. This attribute has now been enhanced to support th e consistent syntax to enable “Context Based” and “Context Free” repetition of the same field horizontally. Syntax [Line : <Line Name>] Repeat : <Field Name> [: <Collection Name>] Set : <Count> Where, <Line Name> is the name of the Line. <Field Name> is the name of the Field to be repeated.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 450 <Collection Name> is the name of the collection on which the Field is repeated. I t is optional. <Count> denotes the no. of times the Field has to be repeated, if colle ction name is not specified. Context based Repeat-The 'Repeat' attribute of the line can repeat the contained f ield over a collection. Each field in this case is associated with each obj ect of the collection. Context Free Repeat-The collection parameter in the above syntax is optional. Thi s allows the repetition of a contained field without a collection. Since the no. of times the field is to be repeated is not known, the usage of the attribute SET to specify the cou nt becomes mandatory. In case SET is not specified, the Field will be repeated as per the exi sting Columnar behaviour. Example 1: Item-Wise Party-Wise sales quantity report using Con text-Based Repeat of Field Following screen shows the Item-w ise-Party-wise Report using en hanced columnar capability: Figure 3. Item-wi se-Party-wise Report Following is the code snippet to design the above report using enhanced columnar capability: 1. Collection definitions for Stock Item, for Party, for getting the values, etc., are as follows: [Collection : Smp CFBK Voucher] Type : Voucher Filter : Smp Is Sales VT [Collection : Smp Stock Item] Source Collection : Smp CFBK Voucher Walk : Inventory Entries By : IName : $Stock Item Name Aggr Compute : Billed Qty : SUM : $Billed Qty
TDL_Reference_Manual.pdf
What's New in Release 3. 0 45 1 Keep Source : (). Filter : Smp Non Empty Qty [Collection : Smp CFBK Party] Source Collection : Smp CFBK Voucher Walk : Inventory Entries By : PName : $Party Ledger Name Aggr Compute : Billed Qty : SUM : $Billed Qty Keep Source : (). Filter : Smp Non Empty Qty [Collection n : Smp CFBK Summ Voucher] Source Collection : Smp CFBK Voucher Walk : Inventory Entries By : PName : $Party Ledger Name By : IName : $Stock Item Name Aggr Compute : Billed Qty : SUM : $Billed Qty Keep Source : (). Search Key : $PName + $IName ;; System Formula [System : Formula] Smp Is Sales VT : $$Is Sales : $Voucher Type Name Smp Non Empty Qty : NOT $$Is Empty : $Billed Qty From these Collections, following can be observed: The Rows, i. e., Stock Items, are repeated over the Collection ' Smp Stock Item'. The Columns, i. e., Party Names, are repeated over the Collectio n 'Smp CFBK Party'. The Intersection values between these Rows and Columns, i. e., I t e m w i s e P a r t y w i s e Sales Quantity, are set using the Collection 'Smp CFBK Summ Voucher'. This Col lection is indexed on Methods $PName + $INa me using the Collection Attribu te 'Search Key'. Thus, the Collection is indexed on Party Name and Stock Item Name, wh ich makes it unique across all the Objects within the Collection 'Smp CFBK Summ Vou cher'.  
TDL_Reference_Manual.pdf
What's New in Release 3. 0 452 2. The Lines for Title and Details are repeated for the Party Na mes as shown below: [Line : Smp CFBK Rep Title] Use : Smp CFBK Rep Details Local : Field : Default : Type : String Local : Field : Default : Align : Center Local : Field : Smp CFBK Rep Name : Set as : “Particulars” Local : Field : Smp CFBK Rep Name : Widespaced : Yes Local : Field : Smp CFBK Rep Party : Set as : $PName Local : Field : Smp CFBK Rep Party : Lines : 0 Local : Field : Smp CFBK Rep Col Total : Set as : “Total” [Line : Smp CFBK Rep Details] Fields : Smp CFBK Rep Name, Smp CFBK Rep Party, Smp CFBK Rep Col Total Repeat : Smp CFBK Rep Party : Smp CFBK Party Title Line uses the detail line w here the Field “Smp CFBK Rep P arty” is repeated over the Collection “Smp CFBK Party”. In the Title Line, the Field “Smp CFBK Rep Party” is set with the value “$PName”, which sets the Party Names from the Collection “Smp C FBK Party”. 3. Retrieving the values in cells based on Party name available from context and stock item name available in the field as shown below: [Field : Smp CFBK Rep Name] Use : Name Field Set as : $IName Display : Stock Vouchers Variable : Stock Item Name [Field : Smp CFBK Rep Party] Use : Qty Primary Field Set as : $$Report Object:$$Collection Field By Key:$Billed Qty:+ @SKFormula:Smp CFBKSumm Voucher SKFormula : $PName + #Smp CFBKRep Name Format : “No Zero” Border : Thin Left
TDL_Reference_Manual.pdf
What's New in Release 3. 0 45 3 In this code snippet, we can observe that the Field “Smp CFBK R ep Party” is the intersection between rows & columns. The value is gathered from the Collecti on “Smp CFBK Summ Voucher” using the function $$Collection Field By Key, where the Index Key in the current context is passed as a parameter. “$PName” in the current object context returns the Party Name. Similarly, the Field V alue “#Smp CFBKRep Name” in the current context returns th e Stock Item Name. Hence, the Search Key Index “Party Name + Stock Item Name” for every I ntersection point is passed to this function, which extracts and returns the corresponding Qua ntity from the Collection. 4. Calculating Field Level T otals, i. e., Stock Item T otals, acro ss all Parties is done using the Line Attribute ' To ta l ' and the Function $$T otal, as shown below: [Line : Smp CFBK Rep Details] Total : Smp CFBK Rep Party [Field : Smp CFBK Rep Col Total] Use : Qty Primary Field Set as : $$Total:Smp CFBKRep Party Line “Smp CFBK Rep Details” contains an Attribute 'T otal', whic h accepts Field Names as its value. In other words, we declare at the Line that the Fields a re to be summed for later use. This sum gets accumulated and rendered in the Field “Smp CFBK Rep Co l T otal”, where the function $$T otal returns the accumulated T otal for the given Field Name as the Parameter to this Function. New Built-in Function $$Line Object Since the Line Attribute 'Field' can now be repeated over a Col lection, wherein the Object context inherited from the Line is overridden in the Field; to switch b ack to the parent context, i. e., Line's object context and extract the required method value, a New Fun ction $$Line Object has been introduced. Function-$$Line Object Syntax $$Line Object : <String Formula> Where, <String Formula> can be any expression that gets evaluated in the Object context associated at the current field's parent 'Line' in the Interface Object hiera rchy. Interactive Reporting capabilities using Aggregated or External objects The Actions “Remove Line”, “Show Last Removed Line” and “Show R emoved Lines” work on the concept of Object Identifier. Whenever the collection of internal objects is rendered as a r eport, the default buttons "Remove Line" and “Restore Line” using the above actions work on them as they are uniquely identifiable. In cases where the Collection used contains aggregated Objects, or objects from an external data source like XML, etc., the objects available do not contain a unique identifier. When such collections are rendered, the Actions mentioned above do not wo rk.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 454 In order to overcome the problem, the behaviour of the attribut e 'Search Key' has been enhanced to assign a unique key for such Object Types. It takes a single method or a combination of methods, which will serve as a unique identifier to each object of the aggregated or external collection. It has to be ensured that each object in the collec tion must contain unique values for the method which is assigned as the key. Attribute 'Search Key' enhanced Syntax [Collection : <Collection Name>] Search Key : <Expression> Where, <Expression> evaluates to a unique identifier for each object of the collect ion. It is usually a combination of method names separated by '+', which must make a unique combination for each object of the Collection. Example:1 Please observe the previous sample Item-Wise Party-Wise report, wherein Alt + R Key combination does not work for Removal of Line, as there is no u nique identifier for the Line Object. Each line in the example is repeating over the objects of the collec tion “Smp Stock Item”. T o specify the unique Object identifier, this Collection is altered by specifying the 'Search Key' attribute, with a unique combination of Methods as value. In this case, it is the method name $Iname, i. e., the Stock Item Name, based on which the objects are grouped. [#Collection : Smp Stock Item] Search Key : $IName Example: 2 Following is another example using external data objects as ava ilable in the following XML file, containing the data for Students and corresponding marks in var ious subjects. <Stud Data> <Student> <Name>Rakesh</Name><Subject> <Name>History</Name> <Mark>90</Mark> </Subject><Subject> <Name>Civics</Name> <Mark>90</Mark>
TDL_Reference_Manual.pdf
What's New in Release 3. 0 45 5 </Subject> <Subject> <Name>Kannada</Name> <Mark>90</Mark> </Subject> </Student> <Student> <Name>Uma</Name> <Subject> <Name>History</Name><Mark>8 0</Mark> </Subject> <Subject> <Name>Civics</Name> <Mark>5 0</Mark> </Subject><Subject> <Name>Kannada</Name> <Mark>65</Mark> </Subject> </Student> <Student> <Name>Prashanth</Name><Subject> <Name>History</Name> <Mark>50</Mark> </Subject> <Subject>
TDL_Reference_Manual.pdf
What's New in Release 3. 0 456 <Name>Civics</Name> <Mark>90</Mark> </Subject> <Subject> <Name>Kannada</Name> <Mark>90</Mark> </Subject> </Student> </Stud Data> The data populated from the above XML is displayed as a columna r report as follows: Figure 4. Student-wise-S ubject-wise Marks Report Student-wise Subject-wise Marks information is listed in tabula r form, as shown in the figure. Now, on removing the selected line(s), the required lines must be re moved. Since this report is constructed out of an external source, i. e., XML Data, the same requires a unique identifier for each object in the repeated line. In this case, it is the Student Na me; hence, the Search Key should contain this as an identifier. Following is the sample code required to display the above repo rt in a columnar fashion, with the Remove/Restore Line behaviour incorporated: [Report : Ext XML Data Stud] Form : Ext XML Data Stud [Form : Ext XML Data Stud] Parts : Ext XML Data Stud Bottom Tool Bar Buttons : Bottom Toolbar Btn8, Bottom Toolbar Btn9,+ Bottom Toolbar Btn10 [Part : Ext XML Data Stud] Lines : Ext XML Data Stud Heading, Ext XML Data Stud Info Repeat : Ext XML Data Stud Info : Ext XML Data Students
TDL_Reference_Manual.pdf
What's New in Release 3. 0 45 7 Scroll : Vertical Common Border : Yes [Line : Ext XML Data Stud Heading] Fields : Ext XML Data Stud Name, Ext XML Data Stud Mark Repeat : Ext XML Data Stud Mark : Ext XML Data Stud Subj Summary Local : Field : Default : Type : String Local : Field : Default : Style : Normal Bold Local : Field : Default : Align : Centre Local : Field : Ext XML Data Stud Name : Set As : “Student Name” Local : Field: Ext XML Data Stud Mark: Set As: $Subject Name Local : Collection: Ext XML Data Stud Subj Summary: Delete: Filter Local : Collection: Ext XML Data Stud Subj Summary: +Delete : By: Student Name Border : Thin Top Bottom [Line: Ext XML Data Stud Info] Fields : Ext XML Data Stud Name, Ext XML Data Stud Mark Repeat : Ext XML Data Stud Mark: Ext XML Data Stud Subj Summary[Field : Ext XML Data Stud Name] Use : Name Field Set As : $Name [Field : Ext XML Data Stud Mark] Use : Number Field Set As : $$Number:$Subject Total Align : Right Border : Thin Left [Collection : Ext XML Data Students] Data Source : File XML : "D:\Stud Data. xml" : Unicode XML Object Path : Student : 1 : Stud Data
TDL_Reference_Manual.pdf
What's New in Release 3. 0 458 Search Key : $Name [Collection : Ext XML Data Stud Subj Summary] Source Collection : Ext XML Data Students Walk : Subject By : Student Name : $..Name By : Subject Name : $Name Aggr Compute : Subject Total : SUM : ($$Number:$Mark) Keep Source : (). Filter : For This Student [System : Formula] For This Student : $Student Name = $$Req Object:$Name In this code, Line 'Ext XML Data Stud Info' is repeated over th e Collection 'Ext XML Data Students', where Search Key is specified to be $Name. Hence, th e Remove/Restore Line behaviour will work. 4. Persisting Variables at System Scope in a User Specified File As announced in Release 2. 0, we are aware that the variables at the Report scope can be persisted in a user specified file using the action SA VE V ARIAB LE. This can be re-loaded as required using the action LOAD V ARIABLE. The latest enhancements in variable persistence allow the user to persist and re-load the variables at System Scope (in a User Specified File) as well. 4. 1 Action-SA VE V ARIABLE The action SA VE V ARIABLE, which is used to persist the Report S cope V ariables in a user specified file, now allows us to persist the System Scope V aria bles also. Syntax of this action remains the same. The desired behaviour is achieved with change s in variable list specification. Syntax SAVE VARIABLE : <File Name> [:<Variable List>] Where, <File Name> is the name of the file in which the report scope/ system scope variables are persisted. The extension. PVF will be taken by default, if the file extension is not specified. <Variable List> is the comma-separated list of variables that need to be saved in the file. Variable List specification changes1. Now '*' can also be used to specify the variable list, which means all at 'current scope'. The current scope can either be 'System' or 'Report'.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 45 9 Specifying '*' will ignore the 'Persist' flag and save all the variables in the scope, irrespective of “Persist: Y es” at the 'V ariable' definition lev el. 2. If V ariable list is not provided, it will persist all the var iables which are set as “Persist: Y es” at the V ariable definition level. 3. Dotted notation syntax is also supported in the variable list specification for scope specification. However, this cannot be used for SUB levels. It can be used only for ac cessing parent scope variables. Single Dot “. ” refers to current scope, Double Dot “.. ” to parent scope, Triple Dot “... ” to grandparent scope, and so on. “ (). ” refers to the System Scope. 4. 2 Action-LOAD V ARIABLE The action LOAD V ARIABLE, which is used to load the Report Scop e V ariables in a user specified file, now allows us to load the System Scope V ariable s also. Syntax of this action remains the same. The desired behaviour is achieved with change s in variable list specification. Syntax LOAD VARIABLE : <File Name> [:<Variable List>] Where, <File Name> is the name of the file in which the report scope/ system scope variables are persisted. Specifying file extension is mandatory while loading variable values. <Variable List> is the comma-separated list of variables that need to be loaded from the file. Variable List specification changes : 1. While loading, '*' is not relevant and will be ignored. 2. While loading, 'Persist' flag of the variable is ignored. It is assumed that the variable must have a persist flag OR it is saved forcefully and hence to be loaded. Example:1 There is a requirement to persist values of all system scope va riables in a user specified file and load the values from the file whenever required. Refer to the following code snippet: [#Menu : Gateway of Tally] Add : Button : SLSystem Scope Save, SLSystem Scope Load ;;Buttons SLSystem Scope Save & SLSystem Scope Load are added at the Gateway of T ally Menu to execute the actions S AV E V ARIABLE & LOAD V ARIABLE. [Button : SLSystem Scope Save] Key : Alt+F Action : SAVE VARIABLE : SLSystem Scope. pvf : *Title : “Save Sys Var” Values of all system scope variables will be persisted in the file SLSystem Scope. pvf on execution of the action SA VE V ARIABLE. [Button : SLSystem Scope Load]
TDL_Reference_Manual.pdf
What's New in Release 3. 0 460 Key : Alt + L Action : LOAD VARIABLE : SLSystem Scope. pvf Title : “Load Sys Var” Values of all system scope vari ables will be loaded from the file SLSystem Scope. pvf on execution of the action LOAD V ARIABLE. Example:2 There is a requirement to persist values of all system scope va riables which are set as “Persist : Yes” at variable definition level in a user specified file, and load the values from the file whenever required. Refer to the following code snippet: [#Menu : Gateway of Tally] Add : Button : SLSystem Scope Save, SLSystem Scope Load Buttons SLSystem Scope Save & SLSystem Scope Load are added at the Gateway of T ally Menu to execute the actions SA VE V ARIABLE & LOAD V ARIABLE. [Button : SLSystem Scope Save] Key : Alt+F Action : SAVE VARIABLE : SLSystem Scope. pvf Title : “Save Sys Var” Values of all variables at system scope which are set “Persist : Yes” at variable definition level, will be persisted in the file SLSystem- Scope. pvf on execution of the action SA VE V ARIABLE. [Button : SLSystem Scope Load] Key : Alt + L Action : LOAD VARIABLE : SLSystem Scope. pvf Title : “Load Sys Var” Values of all variables will be loaded from the file SLSystem Scope. pvf on execution of the action LOAD V ARIABLE. Example: 3 There is a requirement to persist the system scope variables SVSymbol In Sign & SVIn Millions in a user specified file, and load the values of these variables f rom the file whenever required. Refer to the following code snippet: [#Menu : Gateway of Tally] Add : Button : SLSystem Scope Save, SLSystem Scope Load Buttons SLSystem Scope Save & SLSystem Scope Load are added at the Gateway of Tally Menu to execute the actions SAVE VARIABLE & LOAD VARIABLE. [Button : SLSystem Scope Save]
TDL_Reference_Manual.pdf
What's New in Release 3. 0 46 1 Key : Alt+F Action : SAVE VARIABLE : SLSystem Scope. pvf : + SVSymbol In Sign,SVIn Millions Title : “Save Sys Var” Values of the system scope variables SVSymbol In Sign & SVIn Millions will be persisted in the file SLSystem Scope. pvf on execution of the action SAVE VARIABLE. [Button : SLSystem Scope Load] Key : Alt + L Action : LOAD VARIABLE : SLSystem Scope. pvf : + SVSymbol In Sign,SVIn Millions Title : “Load Sys Var” V alues of the system scope variables SVSymbol In Sign & SVIn Millions will be loaded from the file SLSystem Scope. pvf on execution of the action LOAD V ARIABLE. Example: 4The following report is displayed in 'Create' mode from a menu item. [Report : Smp SLReport] Form : Smp SLForm Variable : Save Load Var1, Save Load Var2 The variables Save Load Var1 & Save Load Var2 are declared at Report Scope. [Form : Smp SLForm] Parts : Form Sub Title, Smp SL Part Button : Smp Save Var, Smp Load Var Buttons Smp Save Var & Smp Load Var are added at 'Form' Level to execute the actions SA VE V ARIABLE & LOAD V ARIABLE. Let us look into the following scenarios to persist and load Sy stem Scope as well as Report Scope V ariable values: 1. Persist & Load all Report Scope Variables & a specific System Scope Variable [Button : Smp Save Var] Key : Alt + S Action : SAVE VARIABLE : SLReport Cfg. pvf: *,(). SVIn Millions Title : “Save Variable” Values of all variables declared at report scope and the value of system scope variable SVIn Millions will be persisted in the file SLReport Cfg. pvf on execution of the action SA VE V ARIABLE. (The variable SVIn Millions is prefixed with (). to denote the same as System Scope Variable). [Button : Smp Load Var]
TDL_Reference_Manual.pdf
What's New in Release 3. 0 462 Key : Alt + L Action : LOAD VARIABLE : SLReport Cfg. pvf : *,(). SVIn Millions Title : “Load Variable” V ariable list specification* will be ignored. V alues of all rep ort scope variables and the value of system scope variable SVIn Millions will be loaded from the file SLReport Cfg. pvf on execution of the action LOAD V ARIABLE. 2. Persist and Load a specific Report Scope variable & a specifi c System Scope variable [Button : Smp Save Var] Key : Alt + S Action : SAVE VARIABLE: SLReport Cfg. pvf : Save Load Var1,+ (). SVIn Millions Title : “Save Variable” Value of Report scope variable Save Load Var1 and value of system scope variable SVIn Millions will be persisted in the file SLRe- port Cfg. pvf on execution of the action SA VE V ARIABLE. [Button : Smp Load Var] Key : Alt + L Action : LOAD VARIABLE : SLReport Cfg. pvf : Save Load Var1, + (). SVIn Millions Title : “Load Variable” Value of Report scope variable Save Load Var1 and value of system scope variable SVIn Millions will be loaded from the file SLRe- port Cfg. pvf on execution of the action LOAD V ARIABLE. 5. New Events Introduced As a part of the Language enhancements, in recent past, there have been significant enhancements as a part of the Event Framework. Before this release, events introduced were mostly related to handling the application start up and close, and com pany loading and unloading. The Object specific events were mainly focused around trapping even ts while rendering the data on the screen, and printing. In this Release, events have been introduced to handle user specific requiremen ts on data manipulation during Export and Import of data. With the introduction of the Events Start Import, Import Object and End Import, the programmers have got complete control to manipulate the data prior to importing the same into the company. This can be useful in scenarios like Inter-Branch data transfers; where Delivery Note in a branch gets transformed int o Receipt Note in the other, Sales transaction in a Branch gets tran sformed into Purchase transact ion in the other, and so on. Also, an action Import Object has been introduced to begin the Import process. While exporting Full objects to XML and SDF formats; with the i ntroduction of Export Events Before Export, Export Object and After Export, the user will be able to trap these events and get an access to the object being exported, which can be altere d as required before export. This
TDL_Reference_Manual.pdf
What's New in Release 3. 0 46 3 can be useful in scenarios like changing required information d uring export, not displaying price/ amount of the stock item while synchronizing Delivery Note to t he branch offices, creating a consolidated sales entry from all the sales transactions of the day, etc. 5. 1 Import Events The following events can be used within Import File Definition: Event-Start Import Syntax On : Start Import : <Logical Condition> : <Action> : <Action Parameters> If the logical condition specified returns TRUE, the Event Start Import executes the actions before beginning the import process. At this stage, the data ob jects will not be available, since it is prior to gathering the data from the file. This event can be us ed to communicate any messages to the user like starting the import process, etc. Event-Import Object Syntax On : Import Object : <Logical Condition> : <Action> : <Action Parameters> If the logical condition returns TRUE, event Import Object executes the actions after gathering the Objects from File, before importing the same in the current c o m p a n y. At this stage, d a t a objects are available, since it is post gathering the data from file. This event is useful to manipulate & transform data from one form to another, i. e., from Receipt Note to Delivery Note, etc. Syntax On: Import Object: <Logical Condition> : Import Object If the Event 'On Import Object' is used, it overrides the defau lt Import Object behaviour, as a result of which, we need to explicitl y specify to begin importing the objects. After performing the necessary actions prior to importing the objects, the Action Im port Object must be specified to instruct the system to continue the import process. Event-End Import Syntax On : End Import : <Logical Condition> : <Action> : <Action Parameters> If the logical condition specified returns TRUE, the Event End Import executes the actions after importing the objects. At this stage, the data objects will not be available, since it is post importing the objects within the current company. This event can be used to communicate any messages to the user like 'ending the import process', 'Import Successful', etc. Example: [#Import File : Vouchers] On : Start Import : Yes : Call : Start Import On : Import Object : Yes : Call : Change Values On : Import Object : Yes : Import Object On : End Import : Yes : Call : End Import
TDL_Reference_Manual.pdf
What's New in Release 3. 0 464 [Function : Start Import] 00 : MSGBOX : “Status” : “Starting Import Process” [Function : Change Values] 00 : SET VALUE : Narration : $Narration + “-Updated by + Import Object Event” 10 : SET TARGET : Ledger Entries[1] 20 : SET VALUE : Ledger Name : “Branch Ledger” [Function : End Import] 00 : MSGBOX : “Status” : “Imported data successfully” In this example, before importing the data, Narration Method is being altered and the first Ledger Name is being altered to Branch Ledger. Before starting and after ending the import process, appropriate messages are being displayed to the user. 5. 2 Export Events The following events can be used within Form Definition: Event-Before Import Syntax On : Before Export : <Logical Condition> : <Action> : <Action Parameters> If the logical condition specified returns TRUE, the Event Before Export executes the action before beginning the export. This event can be used to communic ate any message to the user. Event-Export Object Syntax On : Export Object : <Logical Condition> : <Action> : <Action Parameters> If the logical condition specified returns TRUE, the Event Export Object executes the action before the object is exported. The user will get the object being exported, which can be alte red as required before export. The form level Export Object is used to get an access to the object associated at the Report Level and manipulate the same before e xporting. Syntax On : After Export : <Logical Condition> : <Action> : <Action Parameters> If the logical condition specified returns TRUE, the Event After Export executes the action at the end of Form Export. This event can be used to communicate any m essage to the user. The following events can be used within Line Definition: Event-Export Object in Line Definition Syntax On : Export Object : <Logical Condition> : <Action> : <Action Parameters>
TDL_Reference_Manual.pdf
What's New in Release 3. 0 46 5 If the logical condition returns TRUE, the Event Export Object executes the action before every object is exported. The line level 'Export Object' is used to g et an access to each object associated at the line level and manipulate the same before exp orting. Example: [Form : Exp Evt Form] On : Before Export : Yes : Call : Export Start On : After Export : Yes : Call : Export End Part : Exp Evt Part Button : Export Button Full Object : Yes [Part : Exp Evt Part] Line : Exp Evt Line Repeat : Exp Evt Line : Exp Ledger Scroll : Vertical [Line : Exp Evt Line] On : Export Object: Yes: Call: Export Object:$$Line Fields : Exp Evt Fld1, Exp Evt Fld2 Full Object : Yes [Collection : Exp Ledger] Type : Ledger Fetch : Name, Parent [Function : Export Start] 00 : MSGBOX : “Status” : “Starting Export” [Function : Export Object] Parameter : Line No : Number01 : INSERT COLLECTION OBJECT : Name 02 : SET VALUE : Name : “Led” + “-” + $name+“-” + “00” + $$String : ##Line No [Function : Export End] 00 : MSGBOX : “Status” : “Ending Export”
TDL_Reference_Manual.pdf
What's New in Release 3. 0 466 In this example, the line is repeated over the Collection Exp Ledger which is of type Ledger. The event Export Object at the line level will be triggered before exporting of every l edger object. The function “Export Object”, which is called on occurrence of the event, inserts a new object for the collection "Name" and the method Name (alias name) will be set with the new value by concatenating the strings “Led”, Name of the ledger and the lin e no. prefixed with “00”. Before starting and after ending the export, appropriate messag es are being displayed to the user through the events 'Before Export' and 'After Export' at 'Form' Level. The exported fragments of XML and SDF outputs can be seen in the following figures, in wh ich we can observe that an alias name is created with the value as set inside the function: Figure 5. XML Format Figure 6. SDF Format 6. Enhancement-Programmable Configuration Prior to T ally. ERP 9 release 1. 52, when multiple reports were printed or mass mailing was bein g done in a sequence; before each Action, a configuration report was displayed for user input. This would interrupt the flow, thereby requiring a dedicated person to monitor the process, w hich is time consuming. This had been addressed in T ally. ERP 9 release 1. 6, by providi ng an optional logical parameter to suppress the repeated display for the conf iguration screen, before the invocation of global actions 'Print', 'Export', 'Upload' and 'Email'. 6. 1 Actions enabled for P rogrammable Configurations In order to print, export, upload and email the current report in context, the actions 'Print Report', 'Export Report', 'Upload Report' and 'Email Report' are used. Prior to this release, the programmable configuration was not supported for these actions. With the latest enhancement, the display of configuration screen can be suppressed for these act ions also. The syntax of these actions supporting programmable configurations is: Syntax <Action Name> [ :<Report Name> [:<Logical Value>]]
TDL_Reference_Manual.pdf
What's New in Release 3. 0 46 7 Where, <Action Name> can be any of 'Print', 'Export', 'Mail' and 'Upload'. The actio ns 'Print Report', 'Export Report', 'Upload Report' and 'Email Report' have also b een enabled in the latest release. <Report Name> is name of the report or a dot (. ). Since 'Print Report', 'Expo rt Report', 'Upload Report' and 'Email Report' take the current report in context, and the subsequent parameter is the logical parameter for suppressing the configuration, dot (. ) signifies the specification of the current Report Name. This is an optional parameter. However, it is mandatory in case suppress configuration is to be enabled. <Logical Value> can be TRUE/FALSE or YES/NO. It is an optional parameter. By default, the value is NO. If set to YES, the configuration screen would not be displayed. Example: T o export current report without displaying the configuration s creen: | | 40: EXPORT REPORT:. : TRUE || 7. Optional Default TDL Loading Many Third Party Applications use T ally's rapid application dev elopment environment to render various complex reports using T ally Definition Language (TDL). Ta l l y. ERP 9 acts as a front end application for various external databases to retrieve and mani pulate information, as and when required. T ally, being a comprehensive business application, loads all the TDLs required as per the functional aspects of the Application. In cases where the t hird party applications require using T ally purely as a development platform, loading of complete app lication TDLs may prove to be expensive in terms of startup time. This release onwards, the application TDLs are segregated as: Base TDL Files-This contains the commonly required templates like styles, va riables, buttons, etc., which can be used by any report which is rendere d. Default TDL Files-This contains the TDLs which are specifically meant for funct ional requirements of the T ally. ERP 9 application. This has enabled us to launch T ally using the minimal Base TDL files avoiding the overhead of loading the Default TDL files. This can be achieved by using th e command line parameter /NODEF. The variables to be set as per the requirement of each Action is done in the same way as discussed in prior releases. Refer to the topic “Programmable Configuration for Actions” in Release 1. 6 document for more details.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 468 7. 1 Command Line Parameter-NODEF Syntax <Tally Application> /NODEF Example: D:\Tally. ERP9\Tally. Exe/NODEF/NOINITDL/TDL:"D: \ Party \Custom Reports. TDL" In this case, the T ally. ERP 9 application would start only with Base TDLs, without loading the default TDL Files, which means that T ally Application would sta rt rapidly. None of the INI TDLs will be loaded due to the parameter /NOINITDL. Only the TDL file passed with the parameter /TDL, D:\Party\Custom Reports. TDL will be loaded. 8. Refresh Issues in context of User Defined Function Evaluation As we are already aware, the TDL Procedural artefact “Function” is used in two scenarios: 1. Evaluation-where the function is expected to perform some computation an d return the result to the expression within which it is called. The usage i s similar to a Predefined function. In evaluation mode, the function is called using a “$$”. Example: [Field : My Field] Set as : $$My User Function : Parameter1 : Parameter2 2. Execution-where the function is expected to perform certain set of task s, which changes the state of the application or the data. The usage is similar to a Predefined Action. In execution mode, the function is called usi ng the keyword “Call” and can b e invoked from a Key/Button, a Menu item, an Event, or from within another function. Example: [Key : My Key] Action : CALL : My User Action Fpunction : Parameter1 : Parameter2 In case of predefined Functions, whenever a function accesses a nd manipulates certain UI elements like variable, field, etc., or data elements like method values of objects, a link is established between the element and the calling UI. Each time t hese get manipulated, the function gets re-evaluated, new values are calculated and the corresponding U I is refreshed with new values. In line with the above enhancement, the pr oduct T ally. Developer 9 Release 3. 0 will also support the command line parameter /NODEF. In case the application needs to be started with only the Base TDLs, the option /NODEF will be used.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 46 9 Let us look at the following example to articulate this better: [Variable : My Variable] Type : String [Field : My Field] Type : String Set as : ##My Variable When the report is started, the 'Set as' attribute of the field 'My Field' is evaluated. D uring this evaluation, a link between the Field 'My Field' and the V ariabl e 'My V ariable' (which is accessed for its value) is established. Consider a scenario where, say, a F12:configuration of the report changes the 'My V ariable' val ue. Now, the system would automatically determine that the Field 'My Fi eld' was depending on the value of the variable, which has changed now; and hence, RE-EV ALUA TE the field's 'Set A s ' attribute to get its new value. In case of a TDL procedural “Function”, we faced certain issues, where the fields calling the function for some evaluation were not refreshed with new values when the accessed elements got modified elsewhere, and the function did not get re-evaluated. T o articulate this better, let's extend the previous example by using a user defined function. [Variable : My Variable] Type : String [Field : My Field] Type : String Set as : $$My User Function [Function : My User Function] Returns : String01 : RETURN : ##My Variable In this case, the system would not establish any relation betwe en the Field and the variable, as it is processed via a function; and hence, when the V alue of the v ariable is changed elsewhere, the Field's 'Set As' will not get re-evaluated automatically to get its new value. This issue has been resolved in this Release. The related refre sh problems which might have been have faced by the users in context of using "Function" in the evaluation scenario, have been resolved. However, in some negligible cases, we may hit with performance issues d ue to repeated refresh. This mainly happens when the modification of values of UI / data elements like objects, variables, etc., causes the regeneration of linked UI elements. T o overcome the same, certain rules have been established and implemented at the plat form level itself. In very few cases where one may require a slight change in design of the function, using the new actions and functions may be useful.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 470 8. 1 Function-$$Excl Evaluate This function, when prefixed to an expression, helps in evaluat ing it without establishing the link with the UI elements. There may be a few cases where the progra mmer would not want the system to establish relationship between the caller and the obj ect being accessed, to refresh the value in subsequent modification. In such cases, prefixing $$Excl Evaluate would indicate the same to the system. Example: [Variable : My Variable] Type : String [Field : My Field] Type : String Set as : $$Excl Evaluate:##My Variable OR Set as : $$Excl Evaluate:$$My User Function [Function : My User Function] Returns : String01 : LOG : ##My Variable 02 : RETURN : “Constant String” 8. 2 Action ST ART SUB... END SUB In evaluation mode, the dependent regenerations of UI elements are deferred till the function exit. In cases where it is desired to trigger regenerations based on the set of statements as and when they occur, one can enclose the statements within the ST ART SUB-END SUB action block. T o articulate this better, let's take the previous example, where the V ariable is being a ccessed by a field. The following function, on a button press, changes the v alue of the V ariable two times. [Function : My User function] 01 : SET : My Variable : “First Value”02 : SET : My Variable : ##My Variable + “, Second Value” In normal scenario, as both SET actions are modifying the value of the variable, the field (dependent on this variable) would get re-valuated twice. Howev er, the platform has the ability to do it only once during the end of the function by default, when the functi on is called in EV ALUA TION mode. T o change this behaviour to refresh the field twice, these two SET actions can be covered inside ST ART SUB-END SUB as follows: [Function : My User function]
TDL_Reference_Manual.pdf
What's New in Release 3. 0 47 1 01 : START SUB 02 : SET : My Variable : “First Value” 03 : SET : My Variable : ##My Variable + “, Second Value” 04 : END SUB 8. 3 Action-SUB ACTION The purpose of this action is the same as ST ART SUB-END SUB. The only difference is that this action takes an Action to be executed as parameter. The former one encloses a set of Actions inside the block. Following is the alternative of the previous code by using SUB ACTION, rather than using the ST ART SUB-END SUB action block. [Function : My User function] 01 : SUB ACTION : SET : My Variable : “First Value” 02 : SUB ACTION : SET : My Variable : ##My Variable + “, Second Value” 8. 4 Action ST ART XSUB... END XSUB In execution mode, the dependent regenerations are handled as and when they occur. In cases where we would like to defer regenerations based on the set of statements, we can enclose the statements within the ST ART XSUB... END XSUB block. Let's take the following example to demonstrate this: [Field : My Field] Set as : $Value1 + $Value2 ;; field value depends on the Value1 and Value2 of the current object [Function: Modify Current Obj] 01 : SET VALUE : Value1 : “Something else” 02 : SET VALUE : Value2 : “Another value” This code would normally cause the field to be re-evaluated twi ce during the function execution. However, enclosing it in an XSUB block would convert it into a single r e-evaluation as below: [Function : Modify Current Obj] 01 : START XSUB 02 : SET VALUE : Value1 : “Something else”03 : SET VALUE : Value2 : “Another value” 04 : END XSUB
TDL_Reference_Manual.pdf
What's New in Release 3. 0 472 8. 5 Action-XSUB ACTION The purpose of this action is the same as ST ART XSUB and END XS UB. The only difference is that this action takes an Action to be executed as parameter. The former one encloses a set of Actions inside the block. Following is the alternative of the previous code by using XSUB ACTION, rather than using the ST ART XSUB... END XSUB block. [Function : Modify Current Obj] 02 : XSUB ACTION : SET VALUE : Value1 : "Something else" 03 : XSUB ACTION : SET VALUE : Value2 : "Another value" 8. 6 Report Attribute-'Plain XML' Introduced T ally provides the capability to export any report in XML forma t. The XML generated is in standard format for be tter readability, i. e., line ending characters after each closing tag, indentati on for each sub tag, etc. Most of the applications can directly consume the data available in standard format. However, there are some legacy and non-standard applications which requ ire an XML without formatting and applied styles. They consume the entire unformat ted XML available as a single string, without even a new line character. A new attribute 'Plain XML' has been introduced in 'Report' def inition. This attributes generates the XML without applying any formats and styles. Syntax Plain XML : <Logical Expression> Where, <Logical Expression> can be any expression which evaluates to logical value YES/NO. Example: [Report : Simple Trial balance] Form : Simple Trial balance Title : “Trial Balance” Plain XML : YES 8. 7 Attribute-Format for Quantity Datatype In T ally quantity of a Stock item can be expressed using a Simp le or Compound Unit of Measure. Simple Unit-Unit of measure used to express the quantity of an Item. E. g., kgs, nos, pcs, etc. Compound Unit-The unit of measure which is a combination of Simple units re lated to each other by a conversion factor, is termed as a Compound Unit. Examples of compound units are kg of 1000 gms, dozen of 12 nos, etc. In case of compound unit, the highest unit is referred to as the Base/Primary unit and the sub units thereafter, are referred to as the T ail units. The quantity is always expressed in terms of the Primary unit. A compound unit can be nested further to contain another compound unit as a T ail unit, up to any no. of levels. E. g., Bag of 10kgs of 1000 gms.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 47 3 Example, if the unit of measure used for a Stock item “Grains” is Bag o f 10kgs of 1000 gms and the closing balance is 12-5-250 bags, it means that the quantity of items is 12 bags 5 kgs 250 gms. Whenever the tail unit quantity crosses the conversion factor, it adds up to the bigger unit. If the gms part exceeds 1000 in this example and the value is 12-5-125 0 bags, then it will be converted to 12-6-250 bags. In TDL, the data type to support representation & storage of da ta of the above type is Quantity. It comprises of subtypes Number, Base/Primary units, Alternate/Secondary units and unit symbol. We know that when a method of type 'Quantity' is retrieved in a report, it is always expressed in terms of primary units. In case the Unit of Measure is a nested compound unit, the user may require the quantity in terms of any of the units in the entire Compound unit chain. The 'Format' attribute of Field has been enhanced to specify the T ail unit, in which the quantity value needs to be extracted. Syntax [Field : <Field Name>] Type : Quantity Set As : $<Method Name>Format : "Tail Units:" + <String Expression> Where, <String Expression> must evaluate to any T ail Unit Name used in the Item. Example:As per the previous example, the unit of measure used for the S tock item “Grains” is Bag of 1 0kgs of 1000 gms and the closing balance is 12-5-250 bags. In a field, we m ay require to retrieve the value in kgs or gms instead on bags. For this, the following sp ecification can be used: [Field : Qty Format Enhancement] Use : Qty Primary Field Set As : $Closing Balance Format : “Tail Units:” + “kgs” If Format is “T ail Units:kgs”, value returned is 125kgs250 gms= 12X10 kgs+5kgs & 250 gms If the Format is “T ail Units:gms”, the value returned would be 125250 gms = 12X10X1000 gms+ 5X10 00 gms +25 0 gms. 8. 8 Field Attribute-'Cell Write' Introduced When the data is exported from an external application to Excel Format, especially in the following scenarios, Excel faces refresh issues. Here, we are considering the scenarios when T ally exports the data into Excel. Appropriate conversions take place as per the conversion factors set in the nested Compound unit chain.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 474 1. When a cell in an Excel T emplate is having a formula which de pends on multiple cells which are being written from T ally. If one out of these cells is having a drop-down list, then the excel formula is not refreshed after the Export. 2. If the design of Excel template is depending on one of the Ex cel cells, and this cell is written by Excel Export from T ally, then the template using the contents of this cell will not tak e these changes into effect. This problem can be addressed at the TDL level by writing those data corresponding to cells prior to on the one on which the rest of the cells containing the for mula/template are dependent. The rest of the data can be written as a chunk only. For this purpose, a new attribute ' Cell Write ' has been introduced at Field. This attribute enables writing of the specific field value in the Excel file, before t he entire information gets written. Syntax Cell Write : <Logical Value> Where, <Logical Value> can be YES or NO. Example: [Field : VAT acc Rate Fld] Cell Write : YES 8. 9 Function-'$$Str By Char Code' Introduced Everyone is aware that the Indian government has recently launc hed a symbol to represent the Indian currency. T o display the same in T ally. ERP 9, a function $$Str By Char Code has been introduced in TDL. The function $$Str By Char Code accepts the 'AS CII' code or 'Unicode', and displays the corresponding special symbol. This function can be used in scenarios where the special symbols are to be displayed in T ally. ERP 9, e. g., foreign curre ncy symbol. Syntax $$Str By Char Code : <ASCII code/Unicode> Where, <ASCII code/Unicode> can be any expression which returns a valid ASCII or Unicode nu mber. (This number must be in decimal system). For example the ASCII code for the new rupee symbol is 8377, fo r Carriage Return is 13, etc. Example: [Field : Str By Char Code Report] Set AS : $$Str By Char Code:@@Code Char This attribute has to be used judiciously and strictly as per the above scenarios, since this will increase t he export time multifold.
TDL_Reference_Manual.pdf
What's New in Release 3. 0 47 5 [System : Formula] Code Char : 8377 The new Rupee symbol is displayed in the field 'Str By Char Code R eport'. 8. 10 Function-'$$In Preview Mode' Introduced In scenarios where the printing events 'Before Print' and 'Afte r Print' were used to trigger an Action, the action used to get called even if the report was in 'Preview' mode. T o overcome this problem, the function $$In Preview Mode has been introduced, usin g which, the events can be triggered conditionally as required. The function $$In Preview Mode checks if the report is in 'Previe w' mode or not. It is useful in scenarios where some specific controls are to be applied, relat ed to actual Printing. For example, a document can be printed only once, the voucher cannot be altere d or deleted after printing an invoice, etc. Syntax $$In Preview Mode Example: [#Report : Printed Invoice] On : Print : NOT $$In Preview Mode : CALL : Update Doc Set Printed Flag In this case, the Action created using function '$$Update Doc Set Printed Flag' is triggered only in 'Print' mode and not in 'Preview' mode. 8. 11 Function-'$$Remote User Id' Introduced In a remote environment, multiple users connect to the same company and access the data therein. All the TDLs available at the server are enabled for t he Remote user. There may be scenarios where some restrictions need to be applied to the dat a access based on the user identity. This can be achieved at the TDL level by using a new function $$Remote User Id, which will return the user name of the remote user accessing the TDL. Syntax $$Remote User Id This function, when called in TDL, will return the user name of the remote user at the Server end. 8. 12 Function-'$$In Words' Enhanced Till now, the function $$In Words accepted only 'Amount' data type and di splayed the amount in words. Now, it has been extended to accept 'Number' data type as well, and display it in words. Syntax $$In Words : <Expression> : <Format String> Where, <Expression> can be any expression which evaluates to an Amount or a Number. <Format String> is any string expression used to specify the format, e. g., Fore x, No Symbol, etc. Example:
TDL_Reference_Manual.pdf
What's New in Release 3. 0 476 [Field : In Words] Set as : $$In Words:1 00000 The function displays '”ONE LAKH” in the field 'In Words'. 8. 13 Function-'$$Context Keyword' Enhanced Till now, the function $$Context Keyword has been used to return the Titl e of the Report or Menu. For scenarios like adding a report to the list of favourites, w here the Definition name of the current report is required instead of the report Title, the function $$ Context Keyword has been enhanced to return the Report name or Definition name. Now, the function $$Context Keyword accepts two logical parameters a s follows: $$Context Keyword : [:<1st Logical Expression>] + [:<2nd Logical Expression>] Where, <1st Logical Expression> can be any expression which evaluates to YES/NO. The default va lue of this parameter is NO and it returns the Title of the current report. If the value is specified as YES, then the title of the parent report is returned. If no rep ort is active, then the parameter is ignored. If the attribute 'Title' is not specified in 'Report' definition, then by default, the name of the Report definition is returned. <2nd Logical Expression> can be any expression which evaluates to YES/NO. It specifies t hat the name of the Report definition should be returned, instead o f the Title of the Report. Example: [Field : Context Keyword Rep] Set As : $$Context Keyword : No : Yes Here, the function $$Context Keyword returns the name of the cur rent report definition. Example: [Field : Context Keyword Parent] Set As : $$Context Keyword : Yes : Yes Here, the function $$Context Keyword returns the name of the par ent Interface definition, i. e., either a Menu Definition Name or the Parent Report Definition N ame.
TDL_Reference_Manual.pdf
477 What's New in Release 2. 0 1. TDL Procedural Enhancements With every Release, the TDL Procedural Capabilities are getting strengthened at a commendable pace. The latest along this path is the File Input/Output Capability. 1. 1 TDL Procedural File I nput/Output Capabilities As we are aware, any High level programming language will suppo rt Reading and Writing From/ T o multiple hardware devices. It will have predefined construct s in the form of functions to Read from and Write to a File as well. This file can reside on the h ard disk or on a network, which can be accessed via various protocols HTTP or FTP. This capability introduced in TDL will now pave the way for sup porting import/export operations from the T ally Data Base in the most amazing way. It will now be possible to export almost every piece of information in any Data Format which we can think of. The T ext and Excel Formats are supported, which allow data storage in SDF-Fixed Width, CSV-com ma separated, etc., sufficing the generic data analysis requirements of any business. The TDL artefacts used for supporting various Read/Write operat ions are Actions and Functions. These are made to work only inside the TDL Procedural Block. 'W rite' operations are mostly handled using Actions, and all the file Access and Read operati ons are performed using Functions. These give tremendous control in the hands of the pr ogrammer for performing the data manipulations T o/From the file. And that too, on a file present on a network accessible using the protocols FTP and HTTP. Since these artefacts operate on characters and not bytes, the file encoding ASCII/UNICODE does not have any effect on the operatio ns. File Contexts The entire procedural Read/Write artefacts basically operate on two file contexts: Source file Context When a file is opened for Reading purpose, the context available for all the 'read' operations is the Source File Context. All the subsequent 'read' operations are p erformed on the Source File Context. T arget file Context When a file is opened for Writing purpose, the context availabl e for all the 'write' operations is the T arget File Context. All the subsequent Write operations are pe rformed on the T arget File Context. It is important to understand that these contexts are available only inside the procedural block (User Defined Function), where the files are opened for use. Th e file context concept is different from the concept of Object Context where the Object context is carried over to all its child Objects. File Contexts are only available to the functions, and the subs equent functions are called from within the parent Function. The called function can override th e inherited context by opening a new file within its block.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 478 The file context created by opening a file is available only ti ll the execution of the last statement. Once the control is out of the function, the file is automatica lly closed. However, it is highly recommended as a good programming practice to close a file on e xit. Both the file contexts, i. e., Source and T arget file contexts, are available simultaneously. T h i s makes it possible to read from one file and write to another fi le simultaneously. File Operations A programming language supporting File Read/Write typically sup ports the following operations: Open-This operation identifies the file which needs to be opened fo r Read/Write purpose. Close-This operation closes the opened file after Read/Write. Read-This is an operation to read the data from an opened File. Write-This is an operation to write the data to an opened File. Seek-This is an operation to access the character position in an al ready opened file. Truncate-This is an operation which will delete a particular number of characters/entire contents of the file. General File Operations As discussed, the entire procedural Read/Write concepts basical ly operate on two file contexts, i. e., a source file context and a target file context. Source contex t is used to read the contents from a file which is opened for reading purpose, whereas the ta rget context is used to write the data to a file which is opened for writing purpose. Since both these file contexts are available simultaneously, it is possible to read from one file and write to another file. Action-OPEN FILE It is used to open a text/excel file for read/write operations. The file can reside in Hard Disk, in the main memory or on FTP/HTTP site. Also, it is used to open a fil e for read/write operations. If no parameters are used, then a memory buffer will be created, which will act as a file. This file will be in both read / write mode and will act as both the sour ce and the target context. Based on the mode specified (read/write), the file automatically becomes the source file or the target file, respectively. Syntax OPEN FILE [:<File Name> [:<File Format> [:<Open Mode> [:<Encoding> ]]]] Where, <File Name> can be any expression which evaluates to a regular disk file na me like C: \Output. txt, or to a HTTP/FTP site like “ftp://ftp. tallysolutions. com/Output. txt” <File Format> can be T ext or Excel. By default, 'T ext' mode will be considere d, if not specified. Also, during opening of an existing file, if the mode does not match, the Action will fail. <Open Mode> can be Read / Write. By default, it is Read. If a file is opened for 'Read' purpose, then it must exist. If 'Write' mode is specified, and the file exists, it will be opened for updating. If the file does not exist, a new file is created. If the file is opened in 'Write' mode, it is possible to read from the file as well.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 47 9 <Encoding> can be ASCII or Unicode. If not specified, 'Unicode' is conside red as the default value for 'Write' Mode. In 'Read' mode, this parameter will be ignored and considered, based on the encoding of the file being read. Example: 1 10 : OPEN FILE : “Output. txt” : Text : Write : ASCII A T ext File 'Output. text' is opened in 'Write' mode under the T ally application Folder, a n d i f i t already exists, the same will be opened for appending purpose. Example: 2 10 : OPEN FILE : “http://www. tallysolutions. com/Output. txt” : Text A T ext File 'Output. text' is opened in 'Write' mode at the HTTP URL specified. If the file already exists, the same will be opened for appending purpose. Example: 3 10 : OPEN FILE : “C: \Output. xls” : Excel : Read An Excel File 'Output. xls' is opened in 'Read' mode under C dri ve, and if the file does not exist, the Action will fail. Actions-CLOSE FILE and CLOSE T ARGET FILE A file which is opened for Read/Write operation needs to be clo sed, once all the read/write operations are completed. However, if the files are not closed explicitly by the programmer, these are closed by default when the function is returned. But, it is alw ays recommended to close the file after the operations are completed. Files which are opened in the current function can only be clos ed by it. If a function inherits the file contexts from the caller function, then it cannot close these files; however, it can open its own instances of the files. In such cases, the caller context files will not be accessible. Action-CLOSE FILE This action is used to close an opened source file. Syntax CLOSE FILE Example: 10 : OPEN FILE : “Output. xls” : Excel : Read.. 30: CLOSE FILEPlease refer to the functions like $$Make FTPName and $$Make HTTPName for constructing the FTP and HTTP URLs using the various parameters likeserver name, username, password, etc. Refer to T ally. Developer 9 Function Browser for help on usage.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 480 In this example, the Excel file 'Output. xls', which is opened for reading purpo se, is closed. Action-CLOSE T ARGET FILE This action is used to close an opened target file. Syntax CLOSE TARGET FILE Example: 10 : OPEN FILE : “Output. txt” : Text : Write... 30 : CLOSE TARGET FILE In this example, the text file 'Output. txt', which is opened for writing purpos e, is closed. General Functions-$$Tgt File, $File Size Function-$$Tgt File All the file accessing functions, for both text and excel files, operate on the source file context. The function $$Tgt File can be used to switch to the target file context temporarily. It evaluates the expression passed, in the context of the target file. Syntax $$Tgt File : Expression Example: In this example, the objective is to Read the contents of a cel l in Sheet 1 and copy it to a cell in the Sheet 2 of the same file. The function opens the File “ABC. xls” in 'Write' mode. [Function : Sample Func] Variable : Temp : String 10 : SET : Temp : “”20 : OPEN FILE : “Output. xls” : Excel : Write30 : ADD SHEET : “Sheet 1” 40 : WRITE CELL : 1 : 1 : “Item A” 50 : SET: Temp : $$Tgt File : $$File Read Cell:1:160 : ADD SHEET : “Sheet 2” 70 : WRITE CELL : 1 : 1 : ##Temp 80 : CLOSE TARGET FILE
TDL_Reference_Manual.pdf
What's New in Release 2. 0 48 1 In this example, there is no file present in the source file co ntext, as the file is opened in the 'Write' mode. In such case, for reading a value from Sheet 1, the expression $$File Read Cell:1:1 will return no value. Prefixing the expression with $$Tgtfile will t emporarily change the context to T arget File for the evaluation of the expression, and will fetch the value from the cell 1 of Sheet 1, existing in the T arget File context. Function-$$File Size This function will return the size of the file, specified in by tes. It takes an optional parameter. If the parameter is not given, then it works on the current context fi le and returns the size. Syntax $$File Size [:<File Name>] Where, <File Name> is an expression, which evaluates to the file name, along with the path. Example: 10 : Log : $$File Size : “Output. xls” It gives the size of the Excel file 'output. xls', in terms of bytes. Read/Write Operation on T ext Files Writing to a File V arious Actions have been introduced in order to write to a tex t file. These Actions operate on the T arget File context. The scope of these Actions is within the T DL procedural block (User Defined Functions), where the file is opened and the context is availab le. Action-WRITE FILE This Action is used to append a file with the text specified. T he 'write' operation always starts from the end of the file. This Action always works on the target fil e context. Syntax WRITE FILE : <Text To Write> Where, <T ext T o Write> can be any expression evaluating to the data that needs to be w ritten to the file. Example: 10 : OPEN FILE : “Output. txt” : Text : Write 20 : WRITE FILE : “Krishna”30 : CLOSE TARGET FILE Here, a txt file 'Output. txt' is opened in 'write' mode and the content 'Krishna' is appended at the end of the file. Action-WRITE FILE LINE This Action is similar to WRITE FILE, but it also places a new line character (New Line/Carriage Return) after the text. All the subsequent 'writes' begin from the next line. This Action always works on the target context.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 482 Syntax WRITE FILE LINE : <Text To Write> Where, <T ext T o Write> can be any expression evaluating to the data that needs to be w ritten to the file. Example: 10 : OPEN FILE : “Output. txt” : Text : Write 20 : WRITE FILE LINE : “Line 1”30 : WRITE FILE LINE : “Line 2” 40 : CLOSE TARGET FILE Here, a txt file 'Output. txt' is opened in 'Write' mode, and tw o more lines are appended at the end of the file. Action-TRUNCA TE FILE This action removes the contents of the file by setting the fil e pointer to the beginning of the file and inserting an 'end of file' marker. It can be used to erase all characters from an existing file, before writing any new content to it. Syntax TRUNCATE FILE Example: 10 : OPEN FILE : “Output. txt” : Text : Write 20 : TRUNCATE FILE 30 : WRITE FILE : “New Value”40 : CLOSE TARGET FILE In this example, the entire contents of the existing txt file ' Output. txt' are removed and 'New V alue' is inserted subsequently. Action-SEEK FILE This Action operates on the T arget File Context. It is used to move the file pointer to a location as specified by the number of characters. As we already know that it is possible to Read and Write from the T arget File context, all the subsequent Reads and Writ es will be starting from this position. By Default, if the fil e position is not specified, th e 'Read' pointer will be always be from the beginning of file and the 'Write' pointer will be from the end of the file. It has already been covered how to Read from the T arget File Context by using the function $$Tgt File.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 48 3 Syntax SEEK FILE : <File Position> Where, <File Position> can be any expression, which evaluates to a number which is con sidered as the number of characters. Reading a File Some functions and Actions have been introduced, which can oper ate on the Source File context to read from the file or access some information from them. The scope of these functions is within the TDL procedural block (User Defined Functions) where the fil e is opened, and the context is available. It is also possible to read from the T arget File Con text by using the function $$Tgt File. Function-$$File Read This function is used to read data from a text file. It takes a n optional parameter. If the parameter is not specified or has value as 0, it reads one line and ignores the 'end of line' character. However, file pointer is positioned after the 'end of line' character, so that the next read operation starts on the next line. If the no. of characters is mentioned, it reads that many no. of characters. Syntax $$File Read [:<Chars To Read>] Where, <Chars T o Read > can be any expression which evaluates to the number of charac ters to be read. Example: 10 : OPEN FILE : “Output. txt” : Text : Read 20 : LOG : $$File Read 30 : CLOSEFILE In this example, the first line of the text file 'Output. txt' is being read. Function-$$File Is EOF This function is used to check if the current character being r ead is the End of file character. Syntax $$File Is EOF Action-SEEK SOURCE FILE This Action works on a source file context. It sets the current file pointer to the position specified. Zero indicates the beginning of the file and-1 indicates the e nd of the file. The file position is determined in terms of the characters. All the subsequent reads begin from this position onwards. Syntax SEEK SOURCE FILE : <File Position> Where, <File Position> can be any expression evaluating to a number, which is the no. of characters.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 484 Example: 10 : OPEN FILE : “Output. txt” : Text : Read 20 : SEEK SOURCE FILE : 2 30 : LOG : $$File Read 40 : CLOSE FILE In this example, the first line of the file 'Out put. txt' is read, starting from the 3rd character. Read/Write Operation on Excel Files Setting the Active Sheet For an Excel file, all the Read and Write operations will be pe rformed on the Active Sheet. Action-SET ACTIVE SHEET This Action is used to change the Active Sheet during Read and Write operations. Syntax SET ACTIVE SHEET : <Sheet Name> Where, <Sheet Name> is an expression evaluating to a string, which is considered as name of the sheet. Example: 10 : OPEN FILE : “Output. xls” : Excel : Read 20 : SET ACTIVE SHEET : “Sheet 2” 30 : Log : $$File Read Cell : 1 : 1 40 : CLOSE FILE In this example, an Excel sheet Output. xls is opened in Read mo de, 'Sheet 2' is made active and the content is read from the first cell. Writing to a File V arious Actions have been introduced in order to write to an ex cel file. These Actions operate on the T arget File context. The scope of these Actions is within t he TDL procedural block (User Defined Functions), where the file is opened and the context is available. Action-ADD SHEET This Action adds a sheet in the current workbook opened for wri ting. The sheet will always be inserted at the end. If a sheet with the same name already exis ts, it will be made as active. Syntax ADD SHEET : <Sheet Name> Where, <Sheet Name> is an expression evaluating to a string, which is considered as name of the sheet.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 48 5 Example: 10 : OPEN FILE : “Output. xls” : Excel : Write 20 : ADD SHEET : “New Sheet” Here, an existing Excel sheet 'Output. xls' is opened in 'Write' mode and the new sheet 'New Sheet' is inserted at the end of the workbook. Action-REMOVE SHEET This Action removes the specified sheet from current workbook. The entire contents of the sheet will be removed. This Action will fail if the workbook has only one sheet, or if the specified sheet name does not exist in the workbook. Syntax REMOVE SHEET : <Sheet Name> Where, <Sheet Name> is an expression evaluating to a string, which is considered as name of the sheet. Example: 10 : OPEN FILE : “Output. xls” : Excel : Write 20 : ADD SHEET : “New Sheet” 30 : REMOVE SHEET : “Sheet1” In this example, a workbook is created with a sheet named 'New Sheet'. Action-RENAME SHEET This action renames a work sheet. Syntax RENAME SHEET : <Old Sheet Name> : <New Sheet Name> Where, <Old Sheet Name> and <New Sheet Name> can be any expression, evaluating to a string, which will be considered as the name of the sheet. Example: 01 : OPEN FILE : “Output. xls” : Excel : Write 02 : RENAME SHEET : @@Ol Sheet Name : @@New Sheet Name 04 : CLOSE TARGET FILE In this example, the existing sheet is renamed with a new sheet name. Action-WRITE CELL This Action Writes the specified content at the cell address sp ecified by the row and column number of the currently active sheet.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 486 Syntax WRITE CELL : <Row No> : <Column No> : <Content To be Written> Where, <Row No> and <Column No> can be any expression which evaluates to a number, which can be used to identify the cell <Content T o be Written> can be any expression which evaluates to data, which needs to b e filled in the identified cell. Example: 10 : OPEN FILE : “Output. xls” : Excel : Write : ASCII 15 : ADD SHEET : “New Sheet” 20 : WRITE CELL : 1 : 1 : “Krishana”30 : CLOSE TARGET FILE It opens an Excel File 'Output. xls', adds a new sheet, and in t hat sheet, the first cell will have the content as 'Krishna'. Action-WRITE ROW This Action writes multiple cell values at a specified row in t he Active sheet. The no. of values separated by commas are written, starting from initial column no. specified, for the row specif ied. Syntax WRITE ROW : <Row No> : <Initial Column No> : <Comma Separated Values> Where, <Row No> and <Initial Column No> can be any expression which evaluates to a number, which can be used to identify the cell. 'Comma Separated V alues' can be expressions separated with comm a, which evaluate to data that needs to be filled, starting from the cell mentioned by 'R ow Number' and 'Initial Column Number'. Example: 10 : OPEN FILE : “Output. xls” : Excel : Write 20 : ADD SHEET : “New Sheet”30 : WRITE ROW : 1 : 1 : @@Val1, @@Val240 : CLOSE TARGET FILE Here, cells (1,A) and (1,B) are filled with the values from expressions 'V al1' and 'V al2 '. Action-WRITE COLUMN This Action writes multiple cell values at a specified column i n the Active sheet. The no. of values separated by commas are written starting from the initial row n o., specified for the column.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 48 7 Syntax WRITE COLUMN : <Initial Row No> : <Column No> : <Comma Separated Values> Where, <Initial Row No> and <Column No> can be any expression, evaluating to a number, which can be used to identify the cell. 'Comma Separated V alues' can be expressions separated with comm a, which evaluate to data that needs to be filled, starting from the cell mentioned by 'I nitial Row Number' and 'Column Number'. Example: 10 : OPEN FILE : “Output. xls” : Excel : Write 20 : ADD SHEET : “New Sheet” 30 : WRITE Column : 5 : 5 : @@Val3, @@Val4 40 : CLOSE TARGET FILE In this example, cells (5, E) and (6,E) are filled with the values from express ions 'V al3' and 'V al4'. Reading a File Some functions and Actions have been introduced which can opera te on the Source File context to read from the file or access some information from them. The scope of these functions is within the TDL procedural block (User Defined Functions), where the fi le is opened and the context is available. It is also possible to read from the T arget File Con text by using the function $$Tgt File. Function-$$File Read Cell This function returns the content of the cell identified by the mentioned row number and column number of the active sheet. Syntax $$File Read Cell : <Row No> : <Column No> Where, <Row No> and <Column No> can be any expression which evaluates to a number used to identify the row number and the column number. Example: 10 : OPEN FILE : “Output. xls” : Excel : Read 20 : SET ACTIVE SHEET : “Sheet 1”20 : Log : $$File Read Cell : 1 : 1 The Function $$File Read Cell Logs the contents of the first cell of the excel sheet 'Sheet 1. Function-$$File Get Sheet Count This function returns the number of sheets in the current workb ook.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 488 Syntax $$File Get Sheet Count Example: 10 : OPEN FILE : “Output. xls” : Excel : Read 20 : Log : $$File Get Sheet Count The Function $$File Get Sheet Count returns the total number of sh eets in the Excel sheet 'Out-put. xls'. Function-$$File Get Active Sheet Name This function returns the name of the active sheet. Syntax $$File Get Active Sheet Name Example: 10 : OPEN FILE : “Output. xls” : Excel : Read 20 : Log : $$File Get Active Sheet Name The name of the Active sheet is returned after opening the Exce l file 'Output. xls'. Function-$$File Get Sheet Name This Function returns the name of the sheet at a specified inde x. Syntax $$File Get Sheet Name : <Sheet Index> Where, <Sheet Index> can be any expression which evaluates to a number as the Sheet Index. Example: 10 : OPEN FILE : “Output. xls” : Excel : Read Log : $$File Get Sheet Name:1 The Function $$File Get Sheet Name gives the name of the sheet at a particular index Function-$$File Get Sheet Idx This Function Returns the Index of the sheet for a specified sh eet name. Syntax $$File Get Sheetldx : <Sheet Name> Where, <Sheet Name> can be any expression which evaluates to the name of the Excel Sheet.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 48 9 Example: 10 : OPEN FILE : “Output. xls” : Excel : Read 20 : Log : $$File Get Sheet Idx : “Ledgers” The Function $$File Get Sheet Idx gives the index number of the sh eet name. Function-$$File Get Column Name This Function gives the column name in terms of alphabets for t he given index. Syntax $$File Get Column Name:Index Where, <Index> can be any expression which evaluates to the Index number. Example: 10 : OPEN FILE : “Output. xls” : Excel : Read 20 : Log : $$File Get Column Name : 10 The Function $$File Get Column Name returns the value J. Function-$$File Get Columnldx This function returns the index of the column for a given alpha betical name. Syntax $$File Get Columnldx : <Name> Where, <Name> can be any expression which evaluates to the name of the column in alphabets. Example: 10 : OPEN FILE : “Output. xls” : Excel : Read 20 : Log : $$File Get Column Idx:AA The Function $$File Get Column Idx returns the value as 27. Use Case-Import from Excel Scenario ABC Company Limited, which is into trading business, is using T ally. ERP 9. It deals with purchase and sale of computers, printers, etc. The company management wa nts to import the stock items from the Excel sheet, or a text file into T ally. ERP 9. Functional Demo A configuration report is added in T ally. ERP 9 to accept the fi le location, work sheet name, column details, etc. An option to display the error report can also be specified.
TDL_Reference_Manual.pdf
What's New in Release 2. 0 490 Figure 1. The Configuration Report By default, 'Excel' format is selected. But, the user can also select the Import source format as 'T ext' and specify the file details. The text separator charact er should be specified as well, in addition to the column details.
TDL_Reference_Manual.pdf