What is the Datascript Language?

The  Datascript language is a light-weight scripting language with robust functionality that is easy to use and in addition gives you the user the ability to extend it by including independently written scripts.

Datascript is based on the open source scripting language Lua, which is versatile, powerful and easy to learn. Datascript includes many extensions to the underlying code, including new data types (Bit, Datetime, Decimal, Ustring, Utility) and specialized functions (decision, decode, is) that simplify coding. Datascript also includes powerful string pattern matching and date/time manipulation support, which will allow you to easily manipulate string and date values in your code.

Datascript can be extended easily, which enables both QlikView Expressor software and outside developers to add new coding features.

Datascript is used with dataflow operators that are capable of modifying the content of a record. Those operators are:

Datascript is also used with two connectivity operators to read and write data  from/to custom data sources.

When any of the operators that use Datascript are selected, the Edit Rules button is enabled on the Build tab of the Studio ribbon bar.

Additionally, you can use Datascript to develop reusable code in Datascript Modules. Datascript Modules are artifacts that you add to a Library or Project and then use across multiple applications and workspaces.

Finally, you can use Datascript to write scripts that tie execution of your data integration applications to scheduling systems, such as Microsoft Task Scheduler.

To enter Datascript code, you simply start typing, either in the Rules Editor, opened by the Edit Rules button, or in the Datascript Module Editor.  Appropriate entries for a particular point in the script appear in a pop-up list of available functions or fields.  

RE_Typing1.png

In the following documentation, the Datascript language constructs are explained using the usual extended BNF notation, in which:

The following topics cover the rules and conventions of the Datascript language.

expressor patterns

Lexical conventions

Values and Types

Variables

Statements

Expressions

Visibility rules

Note: QlikView Expressor Datascript is based on the Lua scripting language developed at the Pontifical Catholic University of Rio de Janeiro in Brazil.  Information on the language is available in the Lua Reference Manual.  expressor Datascript includes functions that are not part of Lua, and some functionality available in Lua has been removed from  QlikView Expressor Datascript. Specifically, the ability to invoke functions in the Lua I/O, OS, and debug libraries, as well as the ability to call batch/script files, are not accessible to a QlikView Expressor script. Additionally, some Lua functions have been overwritten or removed from QlikView Expressor Datascript. Consequently, the function API descriptions included in the QlikView Expressor documentation are definitive and should be used instead of the descriptions in the Lua Reference Manual.