Sunday 12 February 2012

QlikView TRACE Statement

TRACE is a little used but very useful statement in a QlikView script. It very simply outputs a string to both the script execution progress window and the script log file. The syntax is very simple:

TRACE 'Loading the source tables';

The real benefit of TRACE is being able to write custom place markers or comments into the application script log file. This can help when trying to track down where a script error is occurring or if implementing custom error handling. The latter is an entire topic in itself though and one I might cover in the future.

3 comments:

  1. Be careful when using variable substitution with TRACE statements. the value of the variable cannot itself *output* a semi-colon since QVW will interpret that as a end of command and likely cause syntax errors
    e.g.
    LET variable = 'Some piece of text with a semi-colon ; in it' ;
    TRACE $(variable) ;

    The TRACE line will be interpreted as:
    TRACE Some piece of text with a semi-colon ; in it ;

    (note the 2 semi-colons)


    ReplyDelete