Actions in TDL

On this page

Categories of actions

Action association

Components of actions

Global actions

Menu

Modify object

Browse URL

Object specific actions

TDL is an event driven language. Events can be triggered through a Keyboard shortcut or a Mouse click. In an event, some predefined actions get executed. For example:

The Ctrl+A key pressed from a voucher, it accepts the entry screen.

Clicking on the F1 Button from the Gateway of Tally menu results in the pop up of the Company Selection screen.

Actions are activators of a specific task with a definite result. An action always originates from a User Interface Object like Menu, Form, Line or Field.

Release 6 enhancement - Do If

Watch the below video to know about basic Actions in TDL.

Watch the below videos to know about Action Attributes and Event Framework.

Categories of Actions

Actions can be classified into two broad categories, viz

Global Actions

Object Specific Actions

Figure_7.1_Action_Categorization.jpg

Global Actions are not specific to any User Interface Object. For example, Display, Create, Execute, Alter, etc., are Global Actions. They perform the action specified, irrespective of the UI Object. Global Actions are performed on a Report or a Menu.

Object Specific Actions are actions which can act only upon specific UI Objects. For example, ‘Line Down’ is a Part-Specific Action, since Part owns multiple lines and an individual Line cannot move the current focus to the subsequent line. Only the Part can move the focus to the subsequent line. Object Specific Actions are performed on relevant User Interface Objects.

Global Actions

Object Specific Actions

Global Actions are not specific to any User Interface Object

These Actions are specific to a User Interface Object

Can be originated by a Menu, Button/Key or a Field

Can be originated by a Menu, Form, Line or a Field

Performed on a Report or a Menu

Performed on the relevant Interface Object

Example: Create, Display, Alter, Print, Print Report, Modify Object, Display Collection, etc.

Example: Line Up, Line Down, Explode (‘Line’ Object), Form Accept, Form Reject (‘Form’ Object), etc.

Action Association

Actions can be associated at various levels.

Action Association at Menu Definition

Action association at Menu d efinition is done through the Menu Item. Every Menu Item except Quit is associated with an Action. If an Item is added without any action, then the default action associated is to exit from the current M enu.

Syntax

[Menu : <Menu Name>]

Add : Key Item : [Position] : <Display Item> : <Unique Key> :<Action Keyword> : <Action Parameter>

Where,

<Action Keyword> can be any Global Action.

<Action Parameter> is decided by the Action Keyword. If the Action Keyword is Menu , then the Action Parameter necessarily has to be a Menu Name, else it has to be a Report Name.

Example:

[Menu: Commonly Used Reports]

Add : Key Item : Trial Balance : T : Display : Trial Balance

Add : Key Item : At Beginning : Outstandings : O : Menu : Outstandings

In this example, a Menu Commonly Used Reports is defined with 2 Items, viz.,

1. An Item Trial Balance is added displaying the default report Trial Balance. Here, the action is display, so the Action Value has to be a Report Name.

2. An Item Outstandings is added at the beginning to activate another Menu Outstandings. The action here is Menu,so the Action Value required is a Menu Name.

Action Associatio n at Button/K ey Definition

Action Association at B utton/Key definition is done usi n g the attribute A c tio n , followed by the Action Keyword, with the p arameters, if requir e d.

Syntax

[Button : <Button Name>]

Action : <Action Keyword> [: <Action Parameters>]

Where,

<Action Keyword> can be any Global or Object Specific Action.

<Action Parameters> is decided by the Action Keyword. If the Action Keyword is Menu, then the Action Parameter necessarily has to be a Menu Name, else it has to be a Report Name.

Example: Actions with Parameters

[Button : Outstandings]

Key : F5

Action: Menu: Outstandings

[Button : Trial Balance]

Key  : F6

Action : Display : Trial Balance

Action Me n u r e quires a Menu Name as Parameter and Actions Create , Displ a y , Alte r , etc., req u ire a Report Name.

Example: Actions witho u t Parameters

[Button : Printing Button]

Action : Print Report

[Button : Exporting Button]

Action : Export Report

Action Parameters for the Actions Print Report and Export Report are not mandatory. If the Action Parameter is specified, then it prints the specified Report, else it prints the current Report.

Action Association at ‘Field’ Definition

Action Association at Field is done using Action Keyword with parameters and optional condition.

Syntax

[Field : <Field Name>]

<Action Keyword> : <Action Parameters>[: <Condition>]

Where,

<Action Keyword> can be both Global or Object Specific Actions.

<Action Parameters> can be the Value on which these Actions could be performed.

<Condition> is optional. It restricts the action to be performed only if the condition returns TRUE.

Example

[Field : My Trial Balance]

Display : Group : $$IsGroup

Display : Ledger : $$IsLedger

In this example, the Field Trial Balance has 2 statements, viz.,

1. Displaying a Group, if the current object in context is a Group

2. Displaying a Ledger, if the current object in context is a Ledger

Components of Actions

Any Action is always executed with respect to two contexts:

1. Originator

2. Executor

The Originator is one that originates the Action, viz., Menu, Form, Line or Field, e.g., a Down Arrow Key pressed. The event is passed from the current Report to the associated Form, Parts, Lines or Fields. Keys could be associated in Menu, Form, Line or Field. If the activated Key is found in Form, it searches further for Line Association, and then continues till Field. The Lowest Level Key Association gets the highest precedence. If the Key is associated at Form as well as Field, the Key Association at Field Level gets executed. In this case, the Field is the Originator.

The Executer is one on which the action is executed. For example, Form Accept Key, though attached at Field Level, is a Form Action. Hence, Form is the executer of the action. In case of execution, it searches from Report to the Field for the action to be executed. Line Down is a Part Level Action. Though associated at the Form, it will be executed by the Part to move the current focus to the subsequent line. Hence, Part is an executer of the Action Line Down.

Originator

Executer

The Originator initiates the action by associating the Key or a Button

The Executer executes the action associated with the Key or Button, initiated by originator

Global Actions can be originated by Menu, Button/ Key or a Field, and Object Specific Actions by a Menu, Form, Line or a Field

Global Actions are executed by the originator object. However, Object Specific Actions can be executed by Objects other than originator

The sequence followed to gather all Keys originating within a Report is Top to Bottom, i.e., from Report to Field definition. The lowest in the hierarchy gets highest precedence, e.g., if the same key is associated at both Form and Field definitions, the Key at Field Definition is considered for execution.

The sequence followed to consume the Keys originated is from Bottom to Top, i.e., from a Field to a Report Definition. In other words, the lowest in the hierarchy gets the highest preference, e.g., if the same key is relevant for both Part and Line definitions, the Key will be executed in context of the Line Definition.

Example 1

[Key: Create Ledger]

Key : Alt + C

Action : Create : Ledger

[Field: CST Supplier Ledger]

Key : Create Ledger

Associating the Key with the Field, Field is the originator as well as exe­cuter here.

Example 2

[Key: Part Display PgUp]

Key : PgUp

Action : Part PgUp

[System: Form Keys]

Keys : Part Display PgUp

Key Part Display PgUp is originated by Form, but its executer is the Part.

Global Actions

As discussed, Global Actions are Actions that are not specific to any UI Object. Global Action provides an indication to the TDL Interpreter as to which specific task should be executed to fulfil the user requirements. Global Actions are mainly performed on three principal definition types, namely Report, Collection and Menu. Some frequently used Global Actions are discussed below:

Action - Menu

The Action ‘Menu’ acts only on the ‘Menu’ Definition, and vice versa. The value of the ‘Menu’ Action must be a Menu Name. This Menu has to be further defined to list the Items displaying another Menu or a Report. A Menu Definition continues until all the Items are used to display Reports, and there are no further Menu Actions assigned to the final Menu Items.

Example: 1

;; The following code demonstrates the usage of the Action ‘Menu’, along with further Menu Definitions

[#Menu : Gateway of Tally]

Add : Key Item : Sample Item : F : Menu : Sample Final Accounts

;; Menu Definition for the Menu to be displayed when the above Item is activated

[Menu : Sample Final Accounts]

Add : Key Item : Trial Balance : T : Display : Trial Balance

Add : Key Item : Profit & Loss : P : Display : Profit and Loss

Add : Key Item : Balance Sheet : B : Display : Balance Sheet

In this example, the Default Menu Gateway of Tally is altered to add a new Item Sample Item, with the ‘Menu’ action displaying the Sample Final Accounts Sub Menu. Sub Menu Sample Final Accounts will display all components of Final Accounts, i.e.,

Trial Balance

Profit & Loss

Balance Sheet

All the Items here use the ‘Display’ Action. Hence, no further Menu Definition is required.

Note : As seen in the previous topic Objects, Methods and Collections, the action Display takes the Report Name as its parameter, and is used to display the reports, as is specified.

Example: 2

;; The following code demonstrates the usage of Menu and Display Actions and also the relevance of their association in Menu and

;; Reports (through Form)

;; Button Definition to activate a Menu

[Button : Final Accounts]

Key : F5

Action : Menu : Sample Final Accounts

/* Since the above Button activates a Menu, it can be acted only upon a Menu It cannot be associated to a Report */

[#Menu : Gateway of Tally]

Buttons : Final Accounts ;; attaching a button to the menu

[#Form : Group Summary]

Buttons : Final Accounts

;; Above is an incorrect association as Buttons triggering Menu Action cannot be attached to a Form.

;; Button Definition to Display a Report

[Button : Balance Sheet]

Key : F6

Action : Display : Balance Sheet

/* Since the above Button activates a Report, it can be associated to both a Menu and a Report */

[#Form : Group Summary]

Button : Balance Sheet ;; attaching a button to the report

[#Menu : Display Menu]

Button : Balance Sheet ;; attaching a button to the menu

In this example:

A new Button Final Accounts is added to activate a Menu Sample Final Accounts, which is attached to the default Menu ‘Gateway of Tally’.

The Button Final Accounts cannot be attached to a Report, since a Menu cannot be acted upon in a Report. In the example, the Button Final Accounts is attached to Form ‘Group Summary’, which is incorrect since the Menu cannot be called from a Report.

Another Button Balance Sheet is added to display Report Balance Sheet which is enabled in all Reports, using Form Group Summary, and also in the Menu Display Menu.

The Button Balance Sheet can be attached to a Report as well as to a Menu, since the Report can be acted upon by a Report as well as a Menu.

Action - Modify Object

This action alters the methods of an Object at any level in Object Hierarchy. It supports modifying multiple values of an Object by specifying a comma-separated list of Method: Value pairs.

Syntax

Action : Modify Object : <PrimaryObjectSpec>.<SubObjectPathSpec>. MethodName : Value>[,Method Name : <Value> , …] [,<SubObjectPathSpec>. MethodName : <Value>, …..]

The specifications given for < PrimaryObjectSpec >, < SubObjectPathSpec >, Method Name remain same as described in the New Method syntax section in the topic Objects and Collections .

A single Modify Object Action cannot modify methods of multiple primary Objects, but can modify multiple values of an Object.

Modify Object is allowed to have Primary Object Specification only once, i.e., for the first value. Further values permissible are optional in the Sub Object and Method Specification only.

From second value onwards, Sub Object specification is optional. If Sub Object Specification is specified, the context is assumed to be the Primary Object specified for first value. In absence of sub object specification, the previous value specification's leaf object is considered as the context.

Example: 1

[Key : Alter My Object]

Key    : Ctrl + Z

Action : Modify Object : (Ledger,"MyLedger").BillAllocations [First, $Name="MyBill"].OpeningBalance : 100,Address[Last].Address :"Bangalore"

The existing ledger My Ledger is being altered with new values for the Opening Balance for the existing bill and Address . The key Alter My Object can be attached to any Menu or Form.

Example: 2

[Key : Alter My Object]

Key    : Ctrl + Z

Action : Modify Object :(Ledger,"MyLedger").BillAllocations[1].OpeningBalance :1000,Name: ”My New Bill”,+

..Address[First].Address :"Hongasandra Bangalore", Opening Balance:5000

The existing ledger My Ledger is being altered with new values for the Opening Balance applicable on the existing bill, Opening Balance of the ledger and the first line of the Address . The key Alter My Object can be attached to any Menu or Form.

A button bearing the action Modify Object , if associated at Menu definition, requires a primary object specification as Menu, which is not in context of any Data Object.

Example:

[#Menu : Gateway of Tally]

Add : Button : Alter My Object

The following points should be considered while associating a key with the action Modify Object:

Since the Menu does not have any Info Objects in context, specifying Primary Object becomes mandatory.

Since Menu cannot work on scopes like Selected, Unselected, and so on, the scopes specified are ignored.

Any formula specified in the value and evaluated, assumes Menu Object as requestor.

Even Method values pertaining to Company Objects can be modified.

A button can be added in the Menu to specify the action Modify Object at the Menu level.

Action - Browse URL

The action Browse URL is used to provide a link to any web browser, with a URL formula passed as a parameter.

Syntax

Action : Browse URL : <URL Formula>

Example: Field acting as a hyperlink

[Key : Execute Hyperlink]

Key : Left Click

Action : Browse URL : “www.tallysolutions.com”

[Field : Hyperlink Company]

Color : Blue Border : Thin Bottom

Key : Execute Hyperlink

Set as : "Tally Solutions Pvt. Ltd"

Local : Key : Execute Hyperlink : Action : Browse URL: http://www.tally.co.in

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 case of Create action, the user enters the report in order to add values, whereas in 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.

As discussed in the topic on Variables, 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 to 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 to 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.

Actions - Create C o llection , Displa y Collection and Alte r C ollection

Action - Create Co l lection

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.

Action - Display Collection

A M e nu Item or a B utt o n can be used to d isplay a popup of O b je c t names i n a Collection, w hich i n turn, can trigger a R e p ort. On cho o si n g an Object from the po p up, a rep o rt in Displ a y m o de is tri g gered by t h e ac t ion Dis p lay Co llecti o n. T h is a ction c a n be u sed for displ a yi n g the Masters o r Repor t s pertaining to Gro u ps, Led g ers, Stock I tems, 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 selection of an Object. Here, the Report is in Display mode.

Action - 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.

Collection Attributes - Trigger, Variable and Report

The Collection attributes Trigger, Variable and Report support the actions Create Collection, Display Collection and Alter Collection, respectively.

[Collection : My Ledger]

Type : Ledger

Trigger : LedList Select

Report : Selected Ledger

Display Variable : Ledger Name

Attribute - Trigger

The Collection attribute Trigger is used to popup the Object names from a Collection. For example, a List of Items pop up when you choose the

default menu item Stock Item.

Syntax

[Collection : <Collection Name>]

Trigger : < R eport Name>

< Report Name > is the interface used to display the Object names in a Collection.

Attribute - Rep o rt

The collection attribute Report displays a Report based on the Object selected. For example, Item Monthly Summary is a default report being displayed when you choose a particular stock item.

Syntax

[Collection : <Collection Name>]

Report : <Report Name>

where,

< Report Name > is the final report displayed, when an Object is selected from the Collection.

Attribute - Variable

The collection attribute Variable stores the name of the selected Object. This attribute is used with actions - Display Collection and Alter Collection.

Syntax

[Collection : <Collection Name>]

Variable : < Variable Name>

where,

< Variable Name > is the variable storing the Object name for the subsequent Report to be displayed.

Example

[Collection : Stock Items in Display Collection]

Type : Stock Item

Trigger : Stock Item Selection Interface

Report : Stock Item Final Report

Variable : Stock Item Name

Object Specific Actions

Some of the Object Specific actions are discussed in this section:

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.

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.

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 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 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 above declaration.

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 which may require calculations. Therefore, the Calculator key, associating the action Calculator, is attached to the Field.

Action - Do If

The action Do If which was used only as procedural action has been enhanced to support conditional action execution in other definitions like Button. Do If is a system action and it executes the given action when the condition evaluates to True.

Syntax

Do If: <Condition>: <Action Keyword>[:<Action Parameters>]

Where,

<Condition> is any value or expression that can be evaluated to true or false.

<Action Keyword> can be any global or object specific action except the function specific actions.

<Action Parameters> are the list of parameters as required by the action specified, separated by a colon. Depending on the specified action keyword this parameter can be optional.

Example 1:   Do If in function definition

[Function: MastersCount]

........

001 : Do If: (##MasterType = "Group"):Increment : GroupCount

002 : Do If: (##MasterType = "Ledger"):Increment: LedgerCount

E xample 2:   Do If in button definition

[Button: CreateMaster]

Title   : $$LocaleString:”Create Master”

Key     : Alt+F4

ActionEx: Group : Do If:(##MasterType = "Group") : Create : Group

ActionEx: Ledger: Do If:(##MasterType = "Ledger"): Create : Ledger

In this example, if the value of the variable MasterType is Group it opens the default group creation screen, otherwise it opens the ledger creation screen.

Prior to Do If, the conditional action execution was possible using Switch/Option in button definition. Using the action Do If, reduces the number of lines in the code.

Example: Conditional action using Option

[!Form: Contra Color]

Local: Button: Print Button: Option: Vch Print: $$InCreateMode

Local: Button: Print Button: Option: Vch Chq Print: $$InAlterMode

[!Button: Vch Print]

Action: Print Report

[!Button: Vch Chq Print]

Action : Call : Voucher Printing

Example: Conditional actions using  ActionEx

[!Form: Contra Color]

Local: Button: Print Button: Add: ActionEx: CreateMode:Do If: $$InCreateMode:Print Report

Local: Button: Print Button: Add: ActionEx: AlterMode:Do If: $$InAlterMode:Call:Voucher Printing

Learning Outcome

Actions are activators of a specific task with a definite result. An action always originates from User Interface (UI) objects Menu, Form, Line or Field.

Global actions and object specific actions are the different types of actions used in TDL.

Actions can be associated at various levels:

o Action association at Menu definition

o Action association at Button/Key definition

o Action association at Field definition

An action is always executed with respect to two contexts:

o Originator

o Execut e r

Some of t he fre q uently used global a ctions are:

o Menu

o Modi f y object

o Browse URL

o Crea t e and Alter

Some of the object specific actions are:

o Menu Actions – Menu Up, Menu Down, Menu Reject

o Form Actions – Form Accept, Form Reject, Form End

o Part Actions – Part Home, Part End, Part Pg Up

o Line Actions – Explode, Display Object, Alter Object

o Field Actions – Field Copy, Field Paste, Field Erase, Calculator