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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trying to represent an weak entity in qlikview database

Hello!

I have built an Relation Database and now i want QlikView to create it for me. error loading image

The problem I got is that I think don't know how to get the "foreign keys". In the LoadScript I am using the following code, but the foreigns keys aren't correct.

post:

LOAD *
INLINE [
postId, date, title, postEmotion
'1', '2010-02-01', 'About this apple.', ''
];
sentence:
LOAD *
INLINE [
sentenceId, text, emotion, postId
'1', 'he like Spaghetti', 'pos', '1'
];
topic:
LOAD *
INLINE [
topicId, topicName
'1', 'apple'
];
item:
LOAD *
INLINE [
itemId, itemName, topicId
'1', 'Spaghetti', 1'
];
sentenceitem:
LOAD *
INLINE [
sentenceId, itemId
'1', '1'
];




Hope that someone can help me.

Best Regards,

Anders

1 Reply
Miguel_Angel_Baeyens

Hello Anders,

There's no such thing as a "foreign key" in QlikView. It rather associates tables where at least (ideally just) one field is called likewise in both tables. So the values in Table A for field Key for the association to make sense must have a correspondent in field Key from Table B. Once you create the tables sharing one field with the same name, QlikView will associate them. Actually, your are going to see them as only one field with values corresponding to Table A and Table B.

In a very basic example, say there is only a value "A" in field Key in Table A and a value "B" in field Key in Table B, QlikView will associate them either, although returning nulls in you aggregations.

TableA:LOAD * INLINE [Key, AmountA, 200]; TableB:LOAD * INLINE [Key, CustomerB, Cust0001];


Drawing a chart using "Customer" as dimension and "Sum(Amount)" as expression will return 200 for null, since there is no possible association betwen both tables.

Hope that helps.