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. For more information, see Modifying regional settings for apps and scripts.

Default regional settings in apps are based on the user profile. These regional format settings are not related to the language displayed in the Qlik Cloud user interface. Qlik Cloud will be displayed in the same language as the browser you are using.

If you are an app creator, you can set the default region for apps you create. For more information, see Setting your preferred regional settings for creating apps and scripts in Qlik Cloud Analytics.

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!