Examples
Basic Example
This example shows basic usage of debugging.
You have a graph with Map. There is the following transformation in Map:
//#CTL2
function integer transform() {
if ($in.0.product == "A") {
$out.0.price = $in.0.basePrice + 5;
} else {
$out.0.price = $in.0.basePrice + 10;
}
return ALL;
}
Stop when else
-branch is reached.
Solution
Right click the line number below else
and select Toggle breakpoint from the context menu. A breakpoint has been created.
Run the graph with Run > Debug. The graph runs until the breakpoint is hit.
When the breakpoint is hit, you are asked to confirm perspective switch. Designer switches to Debug perspective. There you can inspect variables, manage breakpoints, or continue in execution.
Using Hit Count
This example shows usage of hit count.
You perform some calculation in cycle. The calculation gives an interesting result in 20th cycle. Stop in 20th cycle without stopping earlier.
Solution
Place breakpoint into the correct place with the cycle.
Right click the breakpoint and select Breakpoint properties….
In breakpoint properties, enable Hit count and enter 20.
Run graph in the debug mode: Run > Debug.
Conditional Breakpoint
This example shows creating a breakpoint that stops only if the field contains a specific value.
Stop transformation only if $in.0.field1
is 500 or more.
Solution
Create a breakpoint.
Right click the breakpoint and select Breakpoint properties….
Select conditional. In the field below, type $in.0.field1 >= 500
.
Run the graph in the debug mode: Run > Debug.
Conditional Breakpoint
This example shows creating a breakpoint that stops only if the field contains a specific value.
Stop transformation only if $in.0.field1
is 500 or more.
Solution
Create a breakpoint.
Right click the breakpoint and select Breakpoint properties….
Select conditional. In the field below, type $in.0.field1 >= 500
.
Run the graph in the debug mode: Run > Debug.
Detecting Changes of the Value
This example shows usage of Conditional breakpoint with the Suspend when value changes option.
Stop at the breakpoint if value of a variable changes.
Solution
Create a breakpoint.
Right click the breakpoint and select Breakpoint properties….
Select Conditional and Suspend when value changes.
Enter a name of the variable to be watched.
Run the graph in the debug mode: Run > Debug.
Updated about 1 year ago