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

Autogenerate data based on conditions

Hi experts,

 

I would like to autogenerate data based on some conditions

 

I already created an inline table 

 

Locations:
Load * Inline [
SubZone, Zone
H1,A
H2,A
H3,B
H4,B
H5,C
H6, C
H7,C
H8,C
];

 

Now i would like to auto generate some locations per zone based on S,X,Y,Z dimensions

where S=L/R

              X = 1/2

              Y=1...12

              Z=1...20

 

The autogenerated table should present all the possible combinations

 

How could i autogenerate it ?

 

 

 

 

2 Replies
shahafei2
Creator
Creator
Author

i made it by using the following script

 

Set vZone= $(gZone);
Set vX= $(gX);
Set vY= $(gY);
set vZ= $(vZ);
set vLocation= $(gLocation);
set vInv= $(gInv);

set vCat=$(gCat)

Locations:
Load
'S'&RowNo() as Zone
AutoGenerate $(vZone);

Inner Join
Load
RowNo() as ID,
Zone,
'H'&IterNo() as X
Resident Locations
While IterNo()<= $(vX);

Inner Join
Load
RowNo() as ID2,
ID,
'A'&IterNo() as Y
Resident Locations
While IterNo()<= $(vY);

Inner Join
Load
RowNo() as ID3,
ID2,
'H'&IterNo() as Z
Resident Locations
While IterNo()<= $(vZ);

Inner Join
Load
RowNo() as ID4,
ID3,
'A'&IterNo() as Location
Resident Locations
While IterNo()<= $(vLocation);

Inner Join
Load
ID4,
Zone&X&Y&Z&Location&'F' as LocationID
Resident Locations;

 

Inventory:
Load
num(RowNo(),'0000000000') as HUID
AutoGenerate $(vInv);

left join
Load
HUID,
ceil(Rand()*(0-$(vCat))+$(vCat),1) as CategoryID
Resident Inventory;

shahafei2
Creator
Creator
Author

Now i would like to create an input table that the user will be able to write 

the name for each CategoryID

 

 

and another input table that will allow the user to set a CategoryID per zone 

 

how could i make it?