Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

when we use Autonumber function in qlikview?

Hi,

   Anyone please tell me

Regards,

Devi.

6 Replies
its_anandrjs

When there is need for Unique numbers in the table or data model See the example from the help

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.

Examples:

autonumber( Region&Year&Month )

autonumber( Region&Year&Month, 'Ctr1' )

Not applicable
Author

Hi,

Autonumber is used in many case

one of the most important use is ,

Like u have 2 column as string or number and by concatenating  two column you are making primarykey

string as a primary key will degrade the performance of your application, so in that case we use autonumber to generate primary key.


Hope this helps

Siva_Sankar
Master II
Master II

Devi,

While creating a datamodel, often you need to create composite keys between tables, i.e. keys that are concatenations of several other keys. These composite keys are often 50-100 characters long (or more) and take up a fair amount of memory. But they are usually not displayed.

So, if you want to save some memory space, you should use the Autonumber() function on the composite keys. It replaces long strings with a short number while maintaining all information.

ali_hijazi
Partner
Partner

autonumber simply transforms a string value as number

but be aware of this fact

suppose autonumber('abc') is 500 and you saved this info as QVD

then on an another reload autonumber('abc') may not be 500 while the value that you saved was 500

I can walk on water when it freezes
Not applicable
Author

I suggest you to concatenate a separator between the fields such as "|"

Imagine the scenario:

Record1 = FieldA=100 and FieldB=10

Record2 = FieldA=10 and FieldB=010

Using only Autonumber:

Autonumber(Record1) = Autonumber(10010) = x

Autonumber(Record2) = Autonumber(10010) = x

Using Autonumber with separato:

Autonumber(Record1) = Autonumber(100|10) = z

Autonumber(Record2) = Autonumber(10|010) = y

It could be difficult to happen but... It's better to prevent

Not applicable
Author

Just beware that the Autonumber() function creates an internal table during the script load, and these tables are dropped after the load.

For this reason, while performing partial reload, the Autonumber() function will not consider the already loaded values when building the internal table, and will ultimately generate duplicates in your model.