Skip to content

Instantly share code, notes, and snippets.

@stefanwalther
Created March 15, 2016 20:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stefanwalther/210eb889b12040ace86b to your computer and use it in GitHub Desktop.
Save stefanwalther/210eb889b12040ace86b to your computer and use it in GitHub Desktop.
Dynamic Qlik Load Script
// Change the amount here to create more records
SET vAmountTransactions=10000;
Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;
ASCII:
Load
if(RecNo()>=65 and RecNo()<=90,RecNo()-64) as Num,
Chr(RecNo()) as AsciiAlpha,
RecNo() as AsciiNum
autogenerate 255
Where (RecNo()>=32 and RecNo()<=126) or RecNo()>=160 ;
Transactions:
Load
TransLineID,
TransID,
mod(TransID,26)+1 as Num,
Pick(Ceil(3*Rand1),'A','B','C') as Dim1,
Pick(Ceil(6*Rand1),'a','b','c','d','e','f') as Dim2,
Pick(Ceil(3*Rand()),'X','Y','Z') as Dim3,
Round($(#vAmountTransactions)*Rand()*Rand()*Rand1) as Expression1,
Round( 10*Rand()*Rand()*Rand1) as Expression2,
Round(Rand()*Rand1,0.00001) as Expression3;
Load
Rand() as Rand1,
IterNo() as TransLineID,
RecNo() as TransID
Autogenerate $(#vAmountTransactions)
While Rand()<=0.5 or IterNo()=1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment