Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
harrywu1
Contributor III
Contributor III

LOAD script : INLINE[data] with columns of random numbers ?

Hi experts,

I am building a new dashboard, so here I need to make up the numbers for simulation. But I am new to LOAD scripts.

For the desired result, I want to insert the random numbers in the column of 'Yield'.

What should the LOAD script look like to make it happen?  It's possibly to be done in one table, instead of creating two and combining them together?

What if the data source (i.e. Customer, Product) is from Excel file, what LOAD script should I put on, to fill in the random numbers in column 'Yield' ?

Any reference link or document that specializes in LOAD script?     Appreciate the help!

Desired result :    

CustomerProductYield
AAK-184.38%
AAMTx85.29%
BBT-1185.98%
BBT-2186.99%
BBX-1189.43%
CCD5590.56%
DDS12X90.69%
DDL11B91.33%
DDK33A94.63%
EEM98.19%
EEP1s98.55%

Table1:

LOAD * INLINE [

Customer,Product

A,AK-1

A,AMTx

B,BT-11

B,BT-21

B,BX-11

C,CD55

D,DS12X

D,DL11B

D,DK33A

E,EM

E,EP1s

];

RandomNumber:

LOAD

Rand()*(1-0.80) + 0.80 as RandomNumber

AutoGenerate(11);

1 Solution

Accepted Solutions
kaanerisen
Creator III
Creator III

Hi Harry,

You can add calculated fields to load part of Inline script.

LOAD *

,Rand()*(1-0.80) + 0.80 as Yield

INLINE [

Customer,Product

A,AK-1

A,AMTx

B,BT-11

B,BT-21

B,BX-11

C,CD55

D,DS12X

D,DL11B

D,DK33A

E,EM

E,EP1s

];

Hope it helps.

View solution in original post

2 Replies
kaanerisen
Creator III
Creator III

Hi Harry,

You can add calculated fields to load part of Inline script.

LOAD *

,Rand()*(1-0.80) + 0.80 as Yield

INLINE [

Customer,Product

A,AK-1

A,AMTx

B,BT-11

B,BT-21

B,BX-11

C,CD55

D,DS12X

D,DL11B

D,DK33A

E,EM

E,EP1s

];

Hope it helps.

harrywu1
Contributor III
Contributor III
Author

Thanks!  Can't believe that's so easy!