Explore Categories

 

 PDF

Procedural-Debugging Related Actions

Start Profile

This action is used to start profiling. The count, time taken and other useful information of every function, collection, etc. gathered along with expressions within the report, are profiled in memory.

Syntax

Start Profile

Example:

[Button : Start Profiling]

Key : Alt + S

Action : Start Profile

Dump Debug

This action is used to dump all debugging information to the file. 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 written.

Example

[Button : Dump Debugging]

Key    : Alt + E

Action : Dump Debug : “Debugged @ ” + @@SystemCurrentTime

 Stop Debug

This action is used to stop debugging. If the file name is passed, 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 written.

Example

[Button: Stop Debugging]

Key    : Alt + O

Action : Stop Debug : “Debugged @ ” + @@SystemCurrentTime

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 written. 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 time-taking artefacts. If it is enabled, the action is similar to calculator pane command DumpZ, else it is similar to Dump.

Example

[Button: Dump Profiling]

Key    : Alt + R

Action : Dump Profile : “Profiled @ ” + @@SystemCurrentTime

Stop Profile

This action is used to stop 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>]

Where,

<File Name> is the name of the file to which the information has to be written.

Example

[Button : Stop Profiling]

Key    : Alt + T

Action : Stop Profile

 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 + C

Action : Start Recording : “BS View”

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 check 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

 Resume Recording

This action resumes the paused recording.

Syntax

Resume Recording

Example

[Button : Resume Recording]

Title  : “Resume”

Key    : Alt + M

Action : Resume Recording

Dump Recording

This action dumps all the recordings to a file with the given separator. Each recording is dumped with its name and keys. This also clears the keys in memory.

The Action ‘Dump Recording’ will accept 2 optional parameters, viz. File Name and Separator.

  • If the File Name is left unspecified, then by default, the Action would dump the recording to the file Macros.log.
  • If the Separator is left unspecified, then by default, the system would consider Tilde (~) as the default separator.

Syntax

Dump Recording [: <File Name> [: <Separator between keys>]]

Where,

<File Name> is the name of the file where macro and keys will be recorded.

<Separator between keys> is the separator used to differentiate the macro name from the keys.

Example

[Button : Dump Recording]

Title : “Dump”

Key : Alt + U

Action : Dump Recording : “BSView.txt” : “-”

On clicking the Button ‘Dump Recording’, a file BSView.txt is created in Tally Application Folder.

Stop Recording

This action stops the recording.

Syntax

Stop Recording

Example

[Button : Stop Recording]

Title : ” Stop”

Key : Alt + N

Action : Stop Recording

Note: 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 Triggering the keys in a loop using the Action ‘Trigger Key’, which will be covered ahead.

LOG

During expression evaluation, intermediated values of the expression can be passed to calculator window and a log file ‘ tdlfunc.log’ insid e the application director y . This is very much helpful for debugging the expression. By default, logging is enabled inside the function .

Syntax

LOG : < Expression>

Where,

< Expression > is the expression whose value needs to be passed to the calculator window.

Example

While finding the factorial of a number , intermediated values are outputted to the ‘Calculator’ win d ow using LOG action

[Function : FactorialOf]

Parameter : InputNumber : Number

Returns   : Number

Variable  : Counter : Number Variable : Factorial : Number

1 : SET   : Counter : 1

2 : SET   : Factor i al : 1

3 : WHILE : ##Counter <= ##I n putNumber

4 : SET   : Factori a l : ##Factorial * # # Counter

5 : SET   : Counter : ##Counter + 1

5a : LOG  : # # Factorial

6 : ENDWHI L E

7 : RETURN : ##Factorial

 Log Object

The action Log Object has been introduced as a Global action. It accepts a filename as the parameter. In this file, the context object, its method and collection are logged.

Syntax

Log Object [:<pathfilename> [:<Overwrite Flag>]]

Where,

<path/filename> is optional. It accepts the name of the file, along with the path in which the log is created. If no filename is specified, the contents of the object are logged in “TDLfunc.log” when logging is disabled, otherwise, it logs into the Calculator pane.

<Overwrite Flag> is used to specify whether the contents should be appended or overwritten. The default value is NO, which appends the content in the file. If set to YES, the file is overwritten.

Example

[Function : FuncLedExp]

       |

Object : Ledger

       |

10 : Log Object : LedgerObj.txt

 Log Target

The action Log Target is a function-specific action. It accepts a filename as a parameter. In this file, the log of the object, its method and collection are created for the target object.

Syntax

Log Target [:<pathfilename> [:<Overwrite Flag>]]

Where,

<path/filename> is optional. It accepts the name of the file along with the path in which the log is created. If no filename is specified, the contents of the object are logged in “TDLfunc.log” when logging is disabled, otherwise, it logs into the Calculator pane.

<Overwrite Flag> is used to specify whether the contents should be appended or overwritten. The default value is NO, which appends the content in the file. If set to YES, the file is overwritten.

Example

[Function : FuncLed Exp]

       |

05 : Set Target

        |

10 : Log Target : LedgerObj.txt

 

Delete Target

Action Delete Target is introduced to delete a primary object from the company.

Syntax

Delete Target

Example

[Function: Emp Led Deletion]

00 : Walk Collection : Empty Ledgers

10 : Set Target

20 : Delete Target

30 : End Walk

In the example, the action Delete Target is invoked. Delete Target then walks the collection Empty Ledgers , sets the current ledger object to target context, and deletes the ledger.

Note: Masters can be deleted only when empty. For example, if there is a transaction under the master that is being deleted, then the master object cannot be deleted.

SET LOG ON

While debugging a Function, sometimes it is required to conditionally Log the values of an expression. If logging is stopped, then logging can be re-started based on the condition Action SET LOG ON. This Action does not require any parameter.

Syntax

SET LOG ON

SET LOG OFF

This Action is used in conjunction with SET LOG ON. Log can be stopped by the Action SET LOG OFF. This Action does not require any parameter.

Syntax

SET LOG OFF

SET FILE LOG ON

This Action is similar to SET LOG ON. SET FILE LOG ON is used to conditionally Log the values of an expression to log file ‘tdlfunc.log’. This Action does not require any parameter.

Syntax

SET FILE LOG ON

SET FILE LOG OFF

This action is used in conjunction with SET FILE LOG ON . Logging the file ‘tdlfunc.log’ can be stopped by the Action SET LOG OFF. This Action does not require any parameter.

Syntax

SET FILE LOG OFF

 

Post a Comment

Is this information useful?
YesNo
Helpful?