Skip to main content Skip to complementary content

Using inline loads to load data

Type data manually into a script to define an inline table, which can be loaded into an app. You can work with inline loads in the Data load editor and Script.

You create inline tables by typing data manually into the script, rather than by connecting to files and databases. Use the required syntax to indicate that the script text is to be interpreted as inline data. Data added with inline loads will be contained in the app if the app is exported. Inline tables are readable and editable within the load script.

A basic inline load creates a table, and inserts the data fields and records.

Inline load in data load editor

Inline load in data load editor.

Basic syntax example

The following script contains a simple inline load.

MyTable:
Load * Inline [
Country, Year, Sales
Argentina, 2014, 66295.03
Argentina, 2015, 140037.89
Austria, 2014, 54166.09
Austria, 2015, 182739.87
];

The following syntax is used for the above inline load:

  • Load * Inline instructs Qlik Sense to load all fields from the inline table that follows.

  • MyTable: defines the name of the table. The list of tables in the app can be accessed from Data model viewer and other areas.

  • Square brackets enclose the data.

  • The first line of the load statement defines the data fields.

  • Commas separate data fields and records.

  • A semi-colon closes the load statement.

Loading an inline table

  1. In an app, open Data load editor.

  2. In a new line, define the table using the required syntax.

    Basic syntax example

  3. When done, click Load data.

Why use inline loads?

Inline loads can be helpful in a number of use cases:

  • Administering and editing data without needing to connect to external sources.

  • Supplementing existing data in the data model. For example, you could add an additional table to a data model that mostly comes from database sources.

  • Adding data that you would like to avoid continuously loading from external sources. This can save time if you know the data source might change in the future, but the data values will remain the same.

  • Ease-of-use for copying and pasting content into the script from other files. For example, .csv files or tables from word processor documents.

  • Creating test scripts that can be copied and pasted quickly.

Syntax overview

Naming the table

You can add a name for the inline table, as you would for other loaded tables. Defining the table name is optional.

After the name of the table, insert a colon.

LOAD and inline statements

An inline table is loaded with the inline clause when you use the LOAD script statement. The inline clause indicates that the subsequent text in the table will contain data that is manually typed into the editor. Unless you indicate otherwise, an inline table uses the txt format, which follows the structure of a delimited text file.

For more information about the LOAD statement, see Load.

Enclosures and data entry

Data entered through an inline clause must be enclosed by specific characters. The following are accepted character combinations for enclosing the data:

  • Square brackets: [ and ]

  • Double quotation marks: " and "

  • Single quotation marks: ' and '

  • Back ticks: ` and `

The character you choose as an enclosure can help you load inline data that contains conflicting characters. For example, if your data contains records with square brackets, you can enclose it with quotation marks or back ticks instead.

For an example of alternative enclosures, see Example - Alternative data enclosures.

Unless you specify an alternative table format (default is txt), text between the enclosures is interpreted in the same way as the content of a file. Hence, where you would insert a new line in a text file, you should also do it in the text of an inline clause: by pressing the Enter key when typing the script.

Ending the inline load

The end of the inline load statement is denoted with a semi-colon.

Data transformations

In a simple inline load with no transformations, the number of columns are defined by the first line. There are three columns in the table loaded by the following example: Product_ID, Supplier_Name, and Product_Category.

Products:

Load * Inline [
Product_ID, Supplier_Name, Product_Category
1, Paracel, Home Decor
2, PageWave, Electronics
3, Talarian, Software
4, Userland, Appliances
];

You can also perform transformations and create new columns within the same inline table. You can use preceding loads, and more than one LOAD statement can be used to load the same table.

For specific examples, see Examples - Inline loads with transformations.

Configuring the format specification in an inline load

Like with other loaded tables, you can modify the format specification of the inline table using format specification items. The format specification is added in brackets. It should be added after the data enclosures, but before the semi-colon ending the LOAD statement. Some of the customizations you can add include:

To use multiple format specification items in the same table, separate them with commas. For example: (Delimiter is '|', no labels)

For full details about the format specification, see Format specification items.

Operators and other clauses

Additionally, since an inline load is a LOAD statement, you can combine other arguments for the LOAD statement into the inline load. For example, use the where or while clause to define whether to load a specific row or not, based on the text within it.

Similarly, you can also use operators outside of the text content itself. With operators, you can customize how you transform the inline data, and also define when to load certain data or not.

For a specific example, see Example - Operators for transformations and clauses.

Example - Alternative data enclosures

You can use square brackets, quotation marks, or back ticks to enclose an inline load. This section illustrates this with an example. For more information, see Enclosures and data entry.

Examples - Alternative delimiters

You can use a character other than a comma to delimit column values in the table. For more information, see Configuring the format specification in an inline load.

Example - Mixing inline loads and loads from other data sources

Example - Omitting column headers

Edit the format specification to load an inline table without defining column headers. This is done with the labels specification (setting it to a value of no labels). For more information, see Configuring the format specification in an inline load.

When you load a table without defining column names, system-defined column names are automatically used.

Example - Loading another data type

This example demonstrates how you can load an inline table in fixed record format. See Configuring the format specification in an inline load.

Example - Multi-line content

This example demonstrates how you can enter multi-line field content into an inline table. See Configuring the format specification in an inline load.

Examples - Inline loads with transformations

These examples show how you can perform calculations on fields loaded inline to create new fields in the data model.

For more information, see Data transformations.

Example - Operators for transformations and clauses

You can use operators to define transformations and specific clauses in the LOAD statement. For more information, see Operators and other clauses.

Operators

Example - Creating null values in an inline table

This example demonstrates how you can use the NullInterpret variable to create null values in your inline data.

NullInterpret

More examples

For additional examples, see Load.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!