Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Qlik Certification Exam Sale - 40% off. Register by June 30, 2020. GET DETAILS
Highlighted
Contributor

auto number

Hi To all,

What is autonumber function and what is use of it? expalin with suitable example?

Regards,

suresh

2 Replies
Highlighted
Valued Contributor III

Re: auto number

Highlighted
MVP
MVP

Re: auto number

autonumber(expression[ , AutoID])

Returns a unique integer value for each distinct evaluated value of expression encountered during the script execution. This function can be used e.g. for creating a compact memory representation of a complex key.

In order to create multiple counter instances if the autonumber function is used on different keys within the script, an optional parameter AutoID can be used for naming each counter.

Consider you have below data..

==============================================

Load

  *,

  Month(Date) as Month

Inline

[

  Customer, Date, Sales

  A, 01/01/2015, 100

  A, 10/02/2015, 120

  A, 15/03/2015, 75

  B, 15/01/2015, 120

  B, 22/02/2015, 140

  B, 18/03/2015, 190

  C, 11/01/2015, 105

  C, 20/02/2015, 120

  C, 22/03/2015, 150

];

================================================

Now you want to associate Unique ID to each distinct customer... add below line

AutoNumber(Customer) as CustomerID,

If you want to associate Unique ID to each distinct customer per month... use as below

AutoNumber(Customer & Month,Customer) as CustomerMonthID;

Hope this would help...