Qlik Sense uses a data load script, which is managed in the Data load editor, to connect to and retrieve data from various data sources. A data source can be a data file, for example an Excel file or a .csv file. A data source can also be a database, for example a Google BigQuery or Salesforce database.
You can also load data using the Data manager, but when you want to create, edit and run a data load script you use the data load editor.
In the script, the fields and tables to load are specified. Scripting is often used to specify what data to load from your data sources. You can also manipulate the data structure by using script statements.
During the data load, Qlik Sense identifies common fields from different tables (key fields) to associate the data. The resulting data structure of the data in the app can be monitored in the data model viewer. Changes to the data structure can be achieved by renaming fields to obtain different associations between tables.
After the data has been loaded into Qlik Sense, it is stored in the app.
Data load editor
You can create scripts to load data in the data load editor. The editor is available from the drop-down menu in Qlik Sense.
When you open the data load editor, the script editor appears in the middle of your screen. Script sections are shown as tabs in the left menu. Qlik Sense automatically creates the Main section. Data connections are shown in the right menu.
The script must be written using the Qlik Sense script syntax. Qlik Sense syntax keywords are highlighted in blue.
There are a number of functions available in the editor to assist you in developing the load script.
Accessing syntax help for commands and functions
There are several ways to access syntax help for a Qlik Sense syntax keyword.
Accessing the help portal
You can access detailed help in the Qlik Sense help portal in two different ways.
Click in the toolbar to enter syntax help mode. In syntax help mode you can click on a syntax keyword (marked in blue and underlined) to access syntax help.
Place the cursor inside or at the end of the keyword and press Ctrl+H.
Using the auto-complete function
If you start to type a Qlik Sense script keyword, you get an auto-complete list of matching keywords to select from. The list is narrowed down as you continue to type, and you can select from templates with suggested syntax and parameters. A tooltip displays the syntax of the function, including parameters and additional statements, as well as a link to the help portal description of the statement or function.
You can also use the keyboard shortcut Ctrl+Space to show the keyword list, and Ctrl+Shift+Space to show a tooltip.
Commenting in the script
You can insert comments in the script code, or deactivate parts of the script code by using comment marks. All text on a line that follows to the right of // (two forward slashes) will be considered a comment and will not be executed when the script is run.
The data load editor toolbar contains a shortcut for commenting or uncommenting code. Click , or press Ctrl + K to comment or uncomment code.
You can indent the code to increase readability. Click to indent the text (increase indentation) or, click to outdent the text (decrease indentation).
Inserting a prepared test script
You can insert a prepared test script that will load a set of inline data fields. You can use this to quickly create a data set for test purposes. Press Ctrl + 00 to insert the test script.
You can view the history of the different versions of your load script in History.