Editing and debugging JavaScript

A comment line starts with two forward slashes // at the beginning of the line.

To validate JavaScript code, click Compile. The result of the validation is displayed in the Tasks tab of the Monitor area at the bottom area of the Procedure Editor.

The Editor offers some efficient features to trace the execution of a script. You can step through a code line-by-line or step through from one Breakpoint to another. At any time, you can check the current value of a variable.

StepsTo step through the code

NoteThe JavaScript Editor and Debugger will work without having input data at the input port of the component. However, in order to produce meaningful results, it is best to populate the input port with data before using the debugging features.

  1. Before stepping through the script, either validate the script or switch to Debug mode.

    A green arrow, pointing initially to line 1, indicates the progress of the execution while stepping.

  2. Make sure, that the result message in the Task tab contains “successful compilation.”

  3. To move to the next line, click Step.

    At any point during stepping you can inspect the current value of a variable. To do this, double-click the variable to select it, and then right-click to open the pop-up menu. The pop-up menu displays the variable name and the current value.

StepsTo add and remove Breakpoints

Rather than stepping through the procedure line-by-line, you can include Breakpoints at selected lines.

  1. To include Breakpoints, click on the line where you want to set the Breakpoint.

  2. Right-click and select Add/Remove Breakpoint from the pop-up menu.

  3. To remove a Breakpoint, right-click it and select Add/Remove from the pop-up menu.

StepsTo step to a Breakpoint

  1. Click Go for each step.

  2. Click Go on the last breakpoint to execute the rest of the script.