Keeping a trace on things

When writing scripts, especially when getting into more advanced structures such as For or For Each loops, it can be important to see what is going on in the script.

The Trace statement allows us to write information to the Script Execution Dialog, which gives immediate feedback on what is going on, so that we can quickly diagnose issues.

Getting ready

Load the following script:

For i = -10 to 10

  Let vTemp = $(i) / If($(i)=-10, 1, Peek('X'));

  Data:
  Load
    $(i) As X,
    Round($(vTemp), 0.001) As Y
  AutoGenerate(1);
  
Next

How to do it...

These steps show you how to use Trace to write to the Script Execution Dialog:

  1. Add a table box with fields X and Y.
  2. The script loaded with errors. We have had errors and we are not getting the correct ...

Get QlikView for Developers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.