Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

WHat is the function of Autogenerate() ??

HEy,

WHat is the function of Autogenerate() ??

Example autogenerate 1 , autogenerate 2 , autogenerate 10 ??

Thanks

5 Replies
maleksafa
Specialist
Specialist

you can use autogenerate when you are building data in your script, the number specify the number of records to be generated.

nikhilgarg
Specialist II
Specialist II
Author

Hey,

If i say :

autogenerate 5;

Then , in this case will it ask me 5 times values to input or will it ask me only once and repeat the same value 5 times ??

Thanks

jagan
Luminary Alumni
Luminary Alumni

Hi,

Autogenerate() is used in Load statement to iterate record by record without any table.  Check example below to generate some sample data the AutoGenerate() is used

SampleData:

LOAD

  Rand() * 100 AS Sequence,

'Product' & Ceil(Rand()) * 100 AS Product

Ceil(Rand()) * 1000 AS Sales

Autogenerate(3);

When you execute above script 3 sample records are generated, it is similar to for loop which loops 3 times.

Hope this helps you.

Regards,

Jagan.

nikhilgarg
Specialist II
Specialist II
Author

Hey,

Let say if i have use dfollowing code :

Data3:

LOAD

Input('Enter value', 'Input box') AS InputValue

AutoGenerate 3;

Then in this case it is asking value only 1 time and using same value in other repetition also. If i input value 12 , then it wil show 12 three times.

Does it behave in same order ??

Thanks.

jagan
Luminary Alumni
Luminary Alumni

Hi, 

Not sure about Input() in AutoGenerate(), may the functionality is like that for Input() i.e, it will take input only for one time. 

If you want to input 3 values, use 3 load statements and concatenate all the tables.

Hope this helps you.

Regards,

Jagan.