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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Resolving a loop on a double relationship (between 2 tables)

Hello,

I am a QV newbie and after I found a solution to my earlier problem (look here : http://community.qlik.com/message/202612 )
I encountered yet another one.
Since I have duplicated my Site table (referred as to "Location" in the previous example) I now have 1 link between Site_From and Transport, plus another link between Site_To and Transport, but that gives me a loop as shown here :

loop_transport.PNG

Though my original (MS Access) database model looks like this :

model_transport.PNG

As explained in the previous thread, I need to have such double relationships because in Transport for example, I need to know the shipping goes from where, to where. Therefore to create relationships in QV I had to duplicate the table Site, and finally got a loop problem, is there any workaround?

I don't understand how I can solve this issue, I am new to QV,

thanks for your time

Labels (1)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

I think it is correct to have two separate branches for "Name_Site_To" and "Name_Site_From". You just need to take it all the way...

In other words: you need to have two City tables too, and link the City tables correctly to the "Name_Site_xx" tables. So you will have one branch for the "To" fields: "Name_Site_To" <--> "City_To" and an identical for the "From" fields. And you need to rename the "Name_Country" into "Name_Country_To" and "Name_Country_From".

Only this way can you make a selection where "Name_Country_To" has a different selection than  "Name_Country_From".

/HIC

View solution in original post

4 Replies
Not applicable
Author

Without getting into your requirements and information, what I think I'd do is concatenate both site tables and leave them with a "direction" identifier field, for example:

Name_Site

Name_City

PlantNumber_Site

ITCostPerEmployee_Site

WrapRate_Site

"Direction" (From, To)

and link that table to your Transport table

hic
Former Employee
Former Employee

I think it is correct to have two separate branches for "Name_Site_To" and "Name_Site_From". You just need to take it all the way...

In other words: you need to have two City tables too, and link the City tables correctly to the "Name_Site_xx" tables. So you will have one branch for the "To" fields: "Name_Site_To" <--> "City_To" and an identical for the "From" fields. And you need to rename the "Name_Country" into "Name_Country_To" and "Name_Country_From".

Only this way can you make a selection where "Name_Country_To" has a different selection than  "Name_Country_From".

/HIC

Not applicable
Author

It would work if I needed to have a Site_From link XOR a Site_To link in my Transport table, but it is not the case since I need to have both. But I cannot have 2 links (from 2 fields in the Transport table) going to the same field in Site unfortunately (because of how QV makes associations)

Not applicable
Author

I completely "forked" the table relationships all the way as you said.

It now looks like this

partially_solved.PNG


And I no longer have a loop warning, thank you!