Debugging scripts, print, and commenting out lines
Debugging scripts
Often during script execution there are internal variables that are calculated along the way. These variables are not necessarily in the output so it may be difficult to trace what is happening. A convenient mechanism for debugging scripts is to add each of these internal variables to the output so that their intermediate values can be seen. These variables do not need to be targeted (and are therefore ignored) but they help trace how your script is proceeding. In the same way, you can add a tracing column where assertions or other comments can be added during processing to verify the functioning of your script.
In addition to the debugging method above, you can also use the Print statement.
Add the word Print
followed by a value to print the values to an output
log after the script has been executed. This is useful if you need to see the value of a
variable at a certain stage, or find what path data is following based on your logic.
Print [myVariable] //String values can be printed by encapsulating with single quotes
Comments
You can comment out lines of ETL code using these two methods:
- Single Line: //
- Multi Line: /* */