QlikView Expressor Datascript Modules

    Originally published on 07-20-2011 11:09 AM

     

    Expressor 3.3 introduces the concept of a Datascript Module.  Datascript  Modules include user-written expressor Datascript functions and/or  initialized variables and are created as first-class workspace  artifacts.  As separate artifacts, they can be shared and reused by  multiple operators, such as Transform and Aggregate, instead of  rewriting the expressor Datascript in each operator that needs it.
    Expressor Datascript code could also be included in External Files, but Datascript Modules are the preferred vehicles for including code external to an operator. External Files must be managed by the user, and External File functions referenced by operators or Datascript Modules must be managed manually by the user. If the user fails to include an External File containing functions in a Deployment Package, references to functions in the External File will fail when the compiled dataflow attempts to run. Datascript Modules are managed automatically, so if a function is a module is referenced by an operator or another Datascript Module, it will automatically be included in Deployment Packages when required. Datascript Modules are also managed for compatibility. For example, name clashes between Modules are prevented.
    Expressor 3.3 ships with several pre-written Datascript Modules that you may find useful.

    • expressor.csv - contains several functions useful for parsing comma delimited text into individual field values
    • expressor.tableutils - contains functions used to serialize and deserialize expressor Datascript tables
    • expressor.ScriptSupport - contains named constants used to manage the  processing within the Read Custom and Write Custom operators

    These files are located in the datascript directory under your Expressor  3 installation directory.  Since the code in these files is used within Expressor 3.3, do not edit the code in these files.  If you want to  modify the processing behavior, you should copy the code into a new  Datascript Module within a Workspace and reference this new module in  your Dataflow.


    expressor.csv

    To use these functions in your coding include the following statement in your code.

    require "expressor.csv"

    This module includes three functions as summarized in the following table.

    expressor.csv.png

    expressor.tableutils

    To use these functions in your coding include the following statement in your code.

    require "expressor.tableutils"

    This module includes two functions as summarized in the following table.

    expressor.tableutils.png

    expressor.ScriptSupport

    To use these named constants in your coding include the following statement in your code.

    require "expressor.ScriptSupport

    This module includes the named constants summarized in the following table.

    expressor.scriptsupport2.png