Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loop problem (modeling)

Hello all,

i need an advice to solve this problem:

i have 4 table:

LOOP (1).png

for each area (site) i need to show its AreaTypeId(SiteTypeId) AreaQty(SiteQty) and its OrderQty, something like that:

table.bmp

but the problem is  connection between AreaTypeId  and TypeID because for each AreaTypeId  i need to connect it to PartID and sum the OrderQty.

by connecting the fields i get a loop.

any idea how to do that?

thank you all.

17 Replies
rohit214
Creator III
Creator III

Hi

Try this script

Directory;

LOAD AreaID,

     AreaName,

     OrderID,

     OrderName,

     SiteID,

     SiteName

FROM

hirar.qvd

(qvd);

LOAD OrderID,

     OrdersQty,

     Time,

     OrderTypeID as OrderType_ID

FROM

log.qvd

(qvd);

LOAD AreaID,

     AreaQty,

     OrderTypeID as Order_Type_ID

FROM

MinArea.qvd

(qvd);

LOAD SiteID,

     SiteQty,

     OrderTypeID

FROM

MinSite.qvd

(qvd);

thanks

rohit

Not applicable
Author

i try your script but when i creat a straight table to sum area order i cant connect between OrderType_ID (from hirarchy and log) and Order_Type_ID (from MinArea).

thank you very much

rohit214
Creator III
Creator III

Hi Avi

I m not able to get  you properly.can you give the format or table what you want,??

make a table and put that value as per your requirment and let me know so i can understand better way.

thanks

rohit

Not applicable
Author

i attached a qvw with a table and my requirments.

Area NameOrder Type IDMin Area QtyOrder Sum
Area_1B2011765
Area_1BE1000
Area_1C20001200
Area_1S1000
Area_2B333190
Area_2C1000000
Area_3B3000011700

i need to create a table as above.

thanks a lot

rohit214
Creator III
Creator III

HI avi

i attached a  modified application

please let me know its working or not and one more thing  still your requirement is not clear  for me

if i am wrong thenplease explain me again

thanks

rohit

Not applicable
Author

no it still not the what i need, i will explain:

there is an hirarchy: Area -> Site -> Orders

for Site and Area there is a minimum qty.

i need to create a table that show for each Area  all its order type id and sum of all orders that under this area and have the same Order Type ID , if there is no order with  Order Type ID (from MinArea) i need to show order type minimum and sum = 0 .

the final table should be like this:

Area NameOrder Type IDMin Area QtyOrder Sum
Area_1B2011765
Area_1BE1000
Area_1C20001200
Area_1S1000
Area_2B333190
Area_2C1000000
Area_3B3000011700

in Area_1 id is in MinArea table and has the order type id B,BE,C,S with its minimum value.

now in log table there is order id 4 and 5 both of them under Area_1,

order id = 4 and 100 have the order type id B and the sum of them is 11765.

order id = 5 has order type id C and order sum is 1200,

and for all the other order type id there is no log with order id under Area_1 with order type id BE or S then the sum will be 0.

i hope it was clear now.

i much appreciate your help.

avi

Not applicable
Author

Hello:

I am not sure if this can help you in any way but have you consider using Left Join statment?

MinArea:

Left Join (Hirar)
LOAD  AreaID,

          AreaQTY,

          OrderTypeID

From

MinArea.qvd

(qvd);

ScreenHunter_02 Feb. 02 10.54.jpg

Not applicable
Author

QlikView has no built-in support for avoiding loop excpet the Loosen tables - that is why the modeling must take into account the creation of composite non-organic keys.