User Interface Related Actions
Create and Alter
The actions Create and Alter act only upon the report definition. These actions activate the report in Create or Alter mode. In other words, the report is started in the Edit mode. In the case of Create action, the user enters the report in order to add values, whereas in the case of Alter, the user enters the report to modify the already created values.
These actions help the user to key in the relevant values. The values thus entered may or may not be stored. The treatment of values depends on need. The values thus entered in the Report by the user, if required to be retained, can be stored as a part of Tally Database or Configuration File.
- All the persistent variable values can be stored in a Configuration File tallysav.TSF for subsequent sessions.
- The values entered in the Report can also be stored as a part of the Tally database.
To store the values as a part of Tally database, the Report must be associated with a Data Object. For example, Group, Ledger, Voucher, etc., are some of the Data objects available in Tally.
For instance, in order to design an interface to create a Ledger:
- The Object ‘Ledger’ must be associated to the Report using Report Attribute ‘Object’
- Values entered by the user in the Fields within the Report must be stored in relevant Methods using Field Attribute ‘Storage’
Example:
/* The following code demonstrates the usage of Action ‘Create’ and Attribute ‘Storage’ at Field Definition to store the values entered within the relevant Object associated at Report Level*/
[#Menu : Gateway of Tally]
Add : Key Item : Ledger Creation : L : Create : Create Ledger
[Report : Create Ledger]
Form : Create Ledger Object : Ledger
;; Object Association done at Report Level
[Form : Create Ledger]
Parts : Create Ledger
[Part : Create Ledger]
Lines : Store LedgerName, Store LedgerGroup
[Line : Store LedgerName]
Fields : Short Prompt, Name Field
Local : Field : Short Prompt : Info : “Name :”
Local : Field : Name Field : Storage : Name
/* Storing value entered by user in Internal Method Name available within Object associated at Report*/
[Line : Store LedgerGroup]
Fields : Short Prompt, Name Field
Local : Field : Short Prompt : Info : “Under :”
Local : Field : Name Field : Storage : Parent
Local : Field : Name Field : Table : Group
/* Similarly, Parent Method is stored with the user entered value which is considered as the Group of the Ledger created. Also Group is a default Table/Collection to display all the default as well as the user defined Groups. Field Attribute Table helps to restrict the user input to a predefined list*/.
In this example:
- The default menu Gateway of Tally has been altered to add a new Item Ledger Creation, which allows the user to create a Ledger.
- Report Create Ledger associates the Object Ledger to it, which indicates that the Report is meant for creating an instance of the Object ‘Ledger’.
- Name and Group of the Ledger are stored in Internal Methods Name and Parent.
Example:
;; The following code demonstrates the usage of ‘Alter’ Action at Button
[Button : My Reco Button]
;; Button meant to do Bank Reconciliation
Key : Alt + F5
Action : Alter : Bank Recon
;; ‘Alter’ Action to trigger Bank Recon Report in ‘Alter’ Mode
Title : “Reconcile”
;; Associating the Button to the Report
[Form : My Bank Vouchers]
Button : My Reco Button
In this example:
- Button My Reco Button is defined with Alter action to alter the report Bank Recon on pressing the Alt + F5 key. It is used for entering dates in the report Bank Reconciliation.
- The button My Reco Button is associated with the Form My Bank Voucher.
Example:
;; The following code demonstrates the usage of Alter Action at Field
[#Menu : Gateway of Tally]
Add : Key Item : Ledger Display : L : Display : My Ledger
[Report : My Ledger]
Form : My Ledger
[Form : My Ledger]
Parts : My Ledger Height : 100% Page Width : 100% Page
[Part : My Ledger]
Lines : My Ledger
Repeat : My Ledger: Ledger
;; Ledger is a default collection of Ledger Objects
Scroll : Vertical
[Line : My Ledger]
Fields : My Ledger
Key : Line Object Enter Alter, Line Click Object Enter Alter
;;The above default Keys act upon Line Definition and the action Alter Object is associated with the Keys, provided the current Report is in Display Mode
[Field : My Ledger]
Set As : $Name
Variable : Ledger Name
;;Variable ‘Ledger Name’ retains the Ledger selected by the user for the subsequent report
Alter : Create Ledger
;; ‘Alter’ Action is used to activate the Report in ‘Alter’ Mode
;; ‘Create Ledger’ is a user defined Report defined while Ledger Creation
In the example,
- Two default keys are associated to a Line definition, that allows a selection of any of the lines, from the set of repeated lines.
- Action associated with these keys is Alter object, which means that on hitting the key, the object associated with the current Line must be altered.
- Mode: Display specified in the keys signifies that current report must be in Display mode.
- Alter action used at the Field definition prompts the report from being activated on the current field, which must be in Alter mode.
Alter Collection
The action Alter Collection is similar to Display Collection , but it triggers the Report in Alter mode. This action is generally used to alter the masters such as Groups, Ledgers, Stock Items, Voucher Types, and so on.
Example:
;; The following code demonstrates the usage of ‘Alter Collection’ Action
[#Menu : Gateway of Tally]
Add : Key Item : Ledger : L : Alter Collection : Ledger
;; where Ledger is a predefined Collection in DefTDL
Though the action is Alter Collection, Alter is meant for the subsequent report, which will be displayed on the selection of an Object. Display Collection, Create Collection and Alter Collection routes the final report through a Collection. Let us understand some critical attributes required to achieve these actions.
Configuration
A Menu Item can be used to create Objects in a Collection with the action Create Collection. This action is generally used for creation of Masters such as Groups, Ledgers, Stock Items, Voucher Types, etc. Create Collection fetches a report through the defined Collection. A report displayed through this action is displayed in Create mode.
Example:
;; The following code demonstrates the usage of ‘Create Collection’ action
[#Menu : Gateway of Tally]
Add : Key Item : Ledger : L : Create Collection : Ledger
;; where a Ledger is a predefined Collection in DefTDL
One can also use the action Create in place of Create Collection, to create Objects in a collection. The only difference is that Create explicitly calls a Report and Create Collection requires a collection. ‘Create Collection’ executes the same report through the defined Collection.
Create Collection
A Menu Item can be used to create Objects in a Collection with the action Create Collection. This action is generally used for creation of Masters such as Groups, Ledgers, Stock Items, Voucher Types, etc. Create Collection fetches a report through the defined Collection. A report displayed through this action is displayed in Create mode.
Example:
;; The following code demonstrates the usage of ‘Create Collection’ action
[#Menu : Gateway of Tally]
Add : Key Item : Ledger : L : Create Collection : Ledger
;; where a Ledger is a predefined Collection in DefTDL
One can also use the action Create in place of Create Collection, to create Objects in a collection. The only difference is that Create explicitly calls a Report and Create Collection requires a collection. ‘Create Collection’ executes the same report through the defined Collection.
Display Collection
A Menu Item or a Button can be used to display a popup of Object names in a Collection, which in turn, can trigger a Report. On choosing an Object from the popup, a report in Display mode is triggered by the action Display Collection. This action can be used for displaying the Masters or Repors pertaining to Groups, Ledgers, StockItems, etc.
Example:
;; The following code demonstrates the usage of ‘Display Collection’ Action
[#Menu : Gateway of Tally]
Add : Key Item : Ledger : L : Display Collection : Ledger
;; where Ledger is a predefined Collection in DefTDL.
Though the action name is Display Collection, Display is meant for the subsequent Report, which will be displayed on the selection of an Object. Here, the Report is in Display mode.
Display Current Collection
Doubt in definition
Action Display Object is used to display the Object in context of the current line.
HTTP Post
A new Key/Button Action HTTP Post has been used for exchanging data with external applications using web services. In other words, ‘HTTP Post’ Action can be used to submit data to a server over HTTP and gather the response. This will enable a TDL Report to perform an HTTP Post to a remote location.
Syntax
[Key : <Key Name>]
Key : <Key Combination>
Action : HTTP Post : <URL Formula> : <Encoding> : <Request Report>: <Error Report> : <Success Report >
Where,
< URL Formula > can be any string formula which resolves as an URL, and is defined under System Definition.
< Encoding > is the encoding scheme, which can be ASCII or UNICODE.
< Request Report > is the name of TDL Report used for generating the XML Request to be sent.
< Error Report > is displayed in case of failure.
< Success Report > is displayed when the post is successful.
Details pertaining to URL (at the receiving end), Encoding Format, Request Report, Error Report and Success Report should be specified along with HTTP Post Action. Universal Resource Locator (URL), for which information is intended, has to be specified through a System Formula.
Encoding Format specifies the encoding to be used while transmitting information to the receiving end. The valid encoding formats are ASCII and UNICODE. UNICODE is set by default.
Request Report is the name of the TDL Report which will be used for generating XML Request to be sent. Error Report and Success Reports are optional, and will enable the programmer to display a Report with the details of the XML response received.
Success or failure is determined by <STATUS> tag in the standard message format. If it is 1, it is a success, otherwise it is a failure. Based on the value of the <STATUS> tag (0/1), the error report and success report are executed, respectively. It will not close or accept the form, if status is not equal to 1. Both Request as well as Response are exchanged in XML format.
Example
[Key : XMLReqResp]
Key : Ctrl + R
Action : HTTP Post : @@MyUrl : ASCII : ReqRep: ERRRespRep : SuccRep
Scope : Selected Lines
;;URL Specification must be done as a system formula
[System : Formula]
MyUrl : http://127.0.0.1:9000
The defined Key XMLReqResp in the code snippet must be attached to an initial Report. When the report is activated and this Key is pressed, the Action HTTP Post activates a defined report ReqRep, which generates the request XML. The response data is made available in the collection called Parameter Collection . The reports ERRRespRep and SuccRep can use the Parameter Collection to display the error message/data in the Report.
The XML response received for the action HTTP POST must be in the Tally compatible XML format. The file “XML for HTTP POST” shows the format received as a reponse from the PHP application file “CXMLResponse as per Tally”.
Form Related Actions
Form Actions – Form Accept, Form Reject, Form End
Actions Form Accept, Form Reject, Form End, etc., act upon Form. They are associated to all Forms (Default as well as User Defined TDL) through the declaration [ System: Form Keys ].
-
Action Form Accept saves the current Form.
-
Action Form Reject rejects the current Form, i.e., the current form is quit without saving.
- Action Form End takes cursor to the Last field in edit mode. In Display mode it takes the cursor to the Last Scrolled line of the form.
Example
[Key : Form Accept]
Key : Ctrl + A
Action : Form Accept
Mode : Edit
[Key : Form Display Reject]
Key : Esc
Action : Form Reject
Mode : Display
[Key : Form End]
Key : Ctrl + End
Action : Form End
[System : Form Keys]
Key : Form Accept, Form Display Reject, Form End
[ System: Form Keys ] declares a list of keys commonly required for a Report. Since all common Form operations like Save Form, Reject Form, Form End, etc., are declared here, a new Form added does not require these keys to be associated, as they are inherited from above declaration.Part Related Actions
Part Actions – Part Home, Part End, Part Pg Up
The actions Part Home, Part End, Part Pg Up, etc., act upon a Part. These keys are associated with all the Forms (Default TDL codes as well as User Defined TDL codes) through the declaration [ System: Form Keys ].
-
Action Part Home positions the cursor to the beginning of the current Part.
-
Action Part End positions the cursor to the end of the current Part.
-
Action Part PgUp is used to quickly scroll the page to view the previous page.
Example
[Key : Part DisplayHome]
Key : Home
Action : Part Home
Mode : Display
[Key : Part Display End]
Key : End
Action : Part End
Mode : Display
[Key : Part Display PgUp]
Key : PgUp
Action : Part PgUp
Mode : Display
[System : Form Keys]
Key : Part Display Home, Part Display End, Part Display PgUp
[ System: Form Keys ] declares a list of keys commonly required for a Part. Since all common Part operations like Part Home, Part End, Part PgUp, etc., are declared here, a new Part added does not require these keys to be associated, since they are inherited from the above declaration.Line Related Actions
Line Actions – Explode, Display Object, Alter Object
Line Actions – Explode, Display Object, Alter Object, etc., act upon a Line.
-
Action Explode explodes a line further to display all the explode details specified in the Line attribute Explode.
-
Action Display Object is used to display the Object in context of the current line.
-
Action Alter Object is used to alter the Object in context of the current line.
Example
[Key : Line Explode]
Key : Shift + Enter
Action : Explode
[Key : Line Object Display]
Key : Enter
Action : Display Object
Mode : Display
[Key : Line Object Alter]
Key : Ctrl + Enter
Action : Alter Object
Mode : Display
[System : Form Keys]
Key : Line Explode
Key : Line Object Display, Line Object Alter
[ System: Form Keys ] declares a list of keys commonly required for a Line. Since all common Line operations like Explode, Display Object, Alter Object, etc., are declared here, a new Line added does not require these keys to be associated, as they are inherited from the above declaration.Field Related Actions
Field Actions – Field Copy, Field Paste, Field Erase, Calculator
The actions Field Copy, Field Paste, Field Erase, Calculator, etc., act on Fields.
- Action Field Copy copies the current field (Field where the cursor is positioned) contents in the OS clipboard, which will be available later.
- Action Field Paste pastes the clipboard contents to the current Field.
- Action Field Erase is used to erase the contents of the current Field at a stretch, without hitting the Backspace or Delete Key.
- Action Calculator is used for Fields that require some computation, the result of which is to be returned to the Field. Fields taking Amounts/Numbers as value require this action.
Example:
[Key : Field Copy]
Key : Ctrl + Alt + C
Action : Field Copy
[Key : Field Paste]
Key : Ctrl + Alt + V
Action : Field Paste
[Key : Field Erase]
Key : Esc
Action : Field Erase
Mode : Edit
[Key : Calculator]
Key : Alt + C
Action : Calculator
Mode : Edit
[Field : NumDecimals Field]
Key : Calculator
[System : Form Keys]
Key : Field Erase
Key : Field Copy, Field Paste
[ System: Form Keys ] declares a list of Keys that are commonly required for any Field. Since all the common Field operations like Field Copy, Field Paste, Field Erase, etc., are declared here, a new Field added does not require these keys to be associated, since they are inherited from the above declaration. The Action ‘Calculator’ is not required for all the Fields; hence, it has not been declared in Form Keys usage List. It has been associated to the Fields where it is required. In the above example, NumDecimals Field is a numeric field that may require calculations. Therefore, the Calculator key, associating the action Calculator, is attached to the Field.Global Actions – MENU, DISPLAY
These global actions are used to invoke a menu or a report in Display mode. The return value of these actions is TRUE if Ctrl+Q is used to reject the report (i.e., via Form Reject To Menu action). It returns FALSE when user uses ‘Esc’ to reject the report (i.e., via ‘Form Accept’ action). For menu, this is only applicable if it is the first in the stack.
Syntax
Menu : <Menu name>
Display : <ReportName>
Example
[Function : DispPaySheet]
01 : Menu : Statements of Payroll
02 : Display : Pay Sheet
The Function ‘DispPaySheet’ opens the Pay Sheet and by pressing Escape, it will pop up the ‘Statements of Payroll’ Menu.
Menu Related Actions
Menu Action – Print/Print Collection
Menu Action Print or Print Collection enters the final Report in ‘Print’ mode.
Syntax
[Menu : <Menu Name>]
Add : Key Item:[Position] : <Display Item> : <Unique Key>: <ActionKeyword> : <Action Parameter>
;; where Action Keyword can be ‘Print’ or ‘Print Collection’ which triggers a list and displays the
;; final report based on user selection
Example
[#Menu : Printing Menu]
Add : Key Item : My Ledgers : L : Print Collection : Ledger Vouchers
Add : Key Item : My Day Book : D : Print : Day Book
Here, we are adding the Item ‘My Ledgers’, which has an action ‘Print Collection’ associated to it.
It displays a collection bearing the List of ledgers, which on user selection, enters the final report in ‘Print’ Mode. On accepting, it directly goes to the printer.
Menu Actions – Menu Up, Menu Down, Menu Reject
The actions Menu Up, Menu Down, Menu Reject, etc., act upon Menu. They are associated to all Menus (Default as well as User Defined TDL) through the declaration [System: Menu Keys].
Example
[Key : Menu Up]
Key : Up
Action : Menu Up
[Key : Menu Down]
Key : Down
Action : Menu Down
[Key : Menu Reject]
Key : Esc
Action : Menu Reject
[System : Menu Keys]
Key : Menu Down, Menu Up, Menu Reject
[System: Menu Keys] declares a list of Keys commonly required for a Menu. Since all common menu operations like Scroll Up, Scroll Down, Drill down, etc., are declared here, a new Menu added does not require these keys to be associated, as they are inherited from above declaration.Button Action – Print Report
Another method of printing reports is by way of associating a Button with an action ‘Print Report’ at the ‘Form’ definition. Action ‘Print Report’ prints the current report by default. This action accepts Report Name as its parameter. If any report other than current needs to be printed, an additional parameter containing Report Name needs to be specified. The current report can pass the user selection to the printing report through a default collection called ‘Parameter Collection’.
Syntax
[Button : <Button Name>]
Action : <Print Report> [: Action Parameter]
Example
Consider a report displaying a list of employees, wherein the user selects the required employees for whom pay slips need to be printed. On clicking the ‘Print’ Button, the current report bearing the list of employees is not required. A new report printed for various pay slips allotted to the selected employees is needed.
[Button : Print Selected Pay slips]
;; Associate this button to the current report displaying the list of employees
Key : Alt + F11
Title : “Print Selected Pay slips”
;; Multiple Payslip Print Report will be printed on activation of this Button
;; The Report should be altered to include the in-built Collection ‘Parameter
;; Collection’ to print the user selection for the list of employees
Action : Print Report : Multi Pay Slip Print
Scope : Selected Lines
[#Report : Multi Pay Slip Print]
Collection : Parameter Collection
Here, the Button ‘Print Selected Pay slips’ is defined with the Action ‘Print Report’, which also has an action parameter, i.e., the Report Name to be printed. The scope of the Button is ‘Selected Lines’, which means that the final Report ‘Multi Pay Slip Print’ must contain only the selected Objects from the current Report. The user selection is passed to the new Report through a Collection ‘Parameter Collection’, which must be used in the destination Report ‘Multi Pay Slip Print’. So, the Report ‘Multi Pay Slip Print’ can be modified and added to the collection ‘Parameter Collection’.