Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
SKiruthiga
Contributor
Contributor

Autonumber

Hello Folks,

Appreciate your time. Looking for an information regarding autonumbers.,my app is around 20GB which has a lot of keys.,now I am trying to replace some of the keys with autonumbers and see reduction in app size. My question is which is the best to get used between Autonumber,Autonumber128 and 256.,is there any recommendation with respect to size reduction.,looking forward to hearing from you.,

thanks a lot!

Kiruthiga

 

10 Replies
QFabian
MVP
MVP

Hi @SKiruthiga , one thing is check your source data, this is important to choose the proper function.

Please check the related help :

https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/Count...


You can only connect autonumber keys that have been generated in the same data load, as the integer is generated according to the order the table is read. If you need to use keys that are persistent between data loads, independent of source data sorting, you should use the hash128, hash160 or hash256 functions.

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The recommended method to autonumber keys is to use AutoNumber statement at the end of your script.  This is much faster than any of the AutoNumber() functions. 

AutoNumber myKeyField;

-Rob

SKiruthiga
Contributor
Contributor
Author

Hello Rob,

Thank you,but unfortunately the app size is not reducing a much with both Autonumber funtion/Autonumber statement at the end of script.

for eg, My app size with out auto number : 19394.53 MB

with autonumber function: 19192.75 MB

with autonumber statement: 19046.97 MB

 

Is there any other approach you could recommend to reduce the app size? I am running behind for a solution.,thank you so much!

 

Kiruthiga

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Use QS Document Analyzer to identify unused fields and then drop those fields from the model .

https://easyqlik.com/qsda/

-Rob

AnthonyM
Contributor II
Contributor II

This one comment saved me few times already. It is not well documented officially (or I struggle to find it) how to use AutoNumer outside of LOAD statements. Thanks Rob!

F_B
Specialist II
Specialist II

Hi @SKiruthiga ,

which solution did you find for your case?

 

Have a nice day

marksouzacosta

Hi @AnthonyM ,

This is how you can use AutoNumber outside your Load Statement:

[us-cities-reduced]:
LOAD
    // Key fields
    id AS %CityId,

    // Regular fields
    name,
    state
FROM
	[lib://IPC DevOps:DataFiles/us-cities-reduced.qvd](qvd)
;

[us-cities-zip-codes]:
LOAD
    // Key fields
    id AS %CityId,

    // Regular fields
    zip_code
FROM
	[lib://IPC DevOps:DataFiles/us-cities-zip-codes.qvd](qvd)
;

Autonumber '%*';

 

You can create any naming convention for your key fields. In my example, I'm saying that all my key fields start with % and ends with whatever else, that is why the '%*'. You could say, for example, my key fields start with @ and ends with Key. In this case will AutoNumber '@*Key'.

 

Reference: https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularS...

 

Regards,

Mark Costa

 

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

AnthonyM
Contributor II
Contributor II

Hi @marksouzacosta , that was more than I was hoping for. 

Thank you! 

Vegar
MVP
MVP

I also endorse the use of autonumber at the end of script.

It is fast to implement, it executes fast (does not break any optimised loads from QVD), and it is easy to turn it on/off for troubleshooting purposes (either by en exit script just before or a simple line comment)