Skip to main content Skip to complementary content

First

The First prefix to a LOAD or SELECT (SQL) statement is used for loading a set maximum number of records from a data source table. A typical use case for using the First prefix is when you want to retrieve a small subset of records from a large and/or slow data load step. As soon as the defined “n” number of records has been loaded, the load step terminates prematurely, and the rest of the script execution continues as normal.

Syntax:  

First n ( loadstatement | selectstatement )

Arguments
Argument Description
n An arbitrary expression that evaluates to an integer indicating the maximum number of records to be read. n can also be enclosed in parentheses: (n).
loadstatement | selectstatement The load statement/select statement that follows the n argument will define the specified table that must be loaded with the set maximum number of records.

Regional settings

Unless otherwise specified, the examples in this topic use the following date format: MM/DD/YYYY. The date format is specified in the SET DateFormat statement in your data load script. The default date formatting may be different in your system, due to your regional settings and other factors. You can change the formats in the examples below to suit your requirements. Or you can change the formats in your load script to match these examples.

Default regional settings in apps are based on the regional system settings of the computer or server where Qlik Sense is installed. If the Qlik Sense server you are accessing is set to Sweden, the Data load editor will use Swedish regional settings for dates, time, and currency. These regional format settings are not related to the language displayed in the Qlik Sense user interface. Qlik Sense will be displayed in the same language as the browser you are using.

Function examples
Example Result
FIRST 10 LOAD * from abc.csv; This example will retrieve the first ten lines from an excel file.
FIRST (1) SQL SELECT * from Orders; This example will retrieve the first selected line from the Orders dataset.

Example – Load the first five rows

Learn more

 

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!