Expression Diagnostics
This will help the developers to debug the TDL Program much faster 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 with the file name.
The dumped debugger information, when opened in Textpad , is as shown below:
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 debugging. If any expression evaluation fails, the Result would display as Failed.
Commands Used for Expression Diagnostics
The Calculator pane commands used for Expression Diagnostics are 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 the developer in order to diagnose the errors in the code, as well as to evaluate and/or set the values to the environment variable.
Syntax
MODE: Debug
Once mode is set to Debug, commands issued in the Calculator Pane 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 expression 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.
Syntax
DUMP
Status
This command is used to check the status of the debugger and returns the statement Expression Debugger is ON or Expression Debugger is OFF.
Syntax
STATUS
Eval
This calculator pane command is used for evaluating an expression.
Example
EVAL : ##SVFromDate
In this example , the value of SVFromDate 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 behavioural 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 : DSPShowOpening : Yes
This will set the value of the variable DSPShowOpening . For instance, prior to viewing Trial Balance, one can set the value of this variable in the Calculator Pane and the Trial Balance will be displayed with the Opening Column.
Print displays the value of a system variable.
Example
Print : SVFromDate
This will return the SVFromDate value.
Reset
This command is used to clear the existing diagnosis data from Me m ory .
Example
RESET
Stop
This command will stop further diagnosis of d a ta.
Example
STOP
Help
This gives the list of Debug commands, with a description of their purpose.
Example
HELP
Actions Used for Expression Diagnostics
Apart from Calculator Pane Commands, there are several TDL Actions provided to programmatically execute the debugging operations. They are:
Action – Start Debug
This action is used to start debugging. All expressions evaluated 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 @ ” + @@SystemCurrentTime
Action – 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
Action – 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
Functions used for Expression Diagnostics
The following function has been introduced to support Debugging operations:
Function – $$IsDebuggerOn
This function is used to check the current status of the Expression Debugger. It returns logical value TRUE if the status of the Debugger is ON.
Syntax
$$IsDebuggerOn
Example
Inactive : NOT $$IsDebugger On