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

For loop in the script

Hi all..

I am quite inexperienced with using qlikview.

I have been trying to use 3 FOR loops. But am unable to get the syntax right.

Any help with the code would be very helpful.

I have 3 input data tables.

WHHandling_WH
WH1100
WH2200

CityHandling_city
C110
C220

PlantHandling_plant
P11,000
P22,000

I am looking for creating a table this way. For each plant, for each WH, all Cities are to be taken and the Total needs to be calculated.

PlantWHCityHandling_plantHandling_WHHandling_cityTotal_Handling
P1WH1C11,000100101,110
P1WH1C21,000100201,120
P1WH2C11,000200101,210
P1WH2C21,000200201,220
P2WH1C12,000100102,110
P2WH1C22,000100202,120
P2WH2C12,000200102,210
P2WH2C22,000200202,220

Thanks in advance.

Ragha

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi Ragha,

You should be able to do:

Table1:

Load

     *

From Table1.xyz

join

Load

     *

From Table2.xyz

join

Load

     *

From Table3.xyz

FinalTable:

Load

     *,

     Handling_plant + Handling_WH + Handling_city as Total_Handling

Resident Table1;

Drop table 1;

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hi Ragha,

You should be able to do:

Table1:

Load

     *

From Table1.xyz

join

Load

     *

From Table2.xyz

join

Load

     *

From Table3.xyz

FinalTable:

Load

     *,

     Handling_plant + Handling_WH + Handling_city as Total_Handling

Resident Table1;

Drop table 1;

Not applicable
Author

Thanks Johannes.

Concepts on Join were not clear for me.

Thanks again.