Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Loops in joing tables

Good day!

in lscript i'm trying to load tables:

WorkingDays:

LOAD

Work_schedule,

    Дата,

    Status

FROM

$(DataPath)WorkingDays.xls

(biff, embedded labels, table is [WDays$])

where Дата < today(1);

WorkingShedule:

LOAD

  Distributor_Id,

  Work_schedule

  FROM

$(DataPath)WorkShedule.xls

(biff, embedded labels, table is [WShedule$]);

Also i have link_ table, which have key fields:

Дата,

Distributor_Id

When i do reload model, i see message with error:

Structure of model:

How i can make join between tables WorkingShedule, WorkingDays, Link_table without having loops in database structure?

Source files of tables WorkingShedule, WorkingDays are in attached files

Thanks.

1 Solution

Accepted Solutions
Highlighted
Champion III
Champion III

Maybe all you need is to join WorkingDays and WorkingSchedule into one table.

There will be another issue, synthetic key, because this new table and Link Table have two fields in common - Distributor ID and Data.  But this is easy to resolve.  For example, create combined key field out of these two fields, and drop Distributor ID and Data from the Link table.

View solution in original post

18 Replies
Highlighted
Specialist
Specialist

try dropping WorkingShedule table at the end of your script.

Highlighted
Creator
Creator

ok. and where i will see data from table WorkingShedule after reload ?

Highlighted

If WorkingSchedule have only the two fields: Distributors_Id and Work_schedule then these two are also present in WorkingDays and Link_Table, respectively. But in case you have more than those two fields within WorkingSchedule, I would just rename one of the two fields so that it doesn't create a loop (for example Distributors_Id as WSDistributor_Id). This would break your direct link between WorkingSchedule and Link_Table, but your indirect link will stay intact breaking the loop.


Hopefully this would be helpful.


Best,

S

Highlighted
Creator
Creator

thanks, but i can not rename any fields in Work_schedule, because Work_shedule is key field with WorkingDays table and Distributor_Id  field also used in others tables

Highlighted

Right, but the reason you are seeing the loop is because you WorkingShedule is connected to WorkingDays which is connected to Link_table which is again connected to WorkingShedule. Now the only way to break the loop is to break the link between one of those tables. (All the fields still exists, just one of them have to renamed.

Will you be able to share a qvw file for demonstration purpose?

Best,

S

Highlighted
Creator
Creator

Thanks, but have not enough rights to share model... Sorry.((

Highlighted
Not applicable

Hey there,

Can you pls explain how the Link table is created? Maybe that needs to be revisited. Also a sample qvw would help in debugging.

Highlighted
Contributor III
Contributor III

Based on the information you have provided, the only way you could have created the link table was to match distribution_id and aata with work_schedule (I need more information if this is not the case). If this is the case, then you join your tables on work_schedule, then you should accomplish the same result while removing the loop. Creating a mapping load with distribution_id and work_schedule would also work.

Highlighted
Champion III
Champion III

Maybe all you need is to join WorkingDays and WorkingSchedule into one table.

There will be another issue, synthetic key, because this new table and Link Table have two fields in common - Distributor ID and Data.  But this is easy to resolve.  For example, create combined key field out of these two fields, and drop Distributor ID and Data from the Link table.

View solution in original post