Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mmarchese
Creator II
Creator II

confused about setting up the data model

I am having trouble understanding the basic principles of making a data model in Qlik Sense because what I'm seeing QS Desktop do and what I'm reading in the documentation and on the forums don't seem to match.

What I did:

  1. I added two tables via the data manager, "fact" and "dim."  Automatically, the fields with the same name were qualified.  So the field "ID" became "fact.ID" and "dim.ID" in the respective tables.
  2. I looked over the auto-generated script in the data load editor.
  3. I hit the magic wand in the data manager, and the two tables got associated via their ID fields.  They retained their qualified names.
  4. I check the auto-generated script in the data load editor.  Nothing had changed.
  5. I attempted to rename the "fact.ID" and "dim.ID" fields to "ID" in the data manager, but QS did not allow it, saying each field must have a unique name.
  6. I switched over to a worksheet and built a dashboard that worked just fine, confirming that the qualified fields had been associated successfully.

What I don't understand:

  1. I read that fields are not associated unless they have identical names and that qualifying them prevents them from being associated.  My experience above completely contradicts this.  Not only can I associate qualified fields, but identical field names are forbidden.  What gives?
  2. I read that associations are based solely on fields having the same name.  That plus the fact that visually associating the fields in the data manager didn't change my script at all, I'm left wondering: why bother associating tables in the data manager at all?
1 Solution

Accepted Solutions
mmarchese
Creator II
Creator II
Author

Okay, reading what you wrote prompted me to take another look at this.  I realized my observation was incorrect that making an association in the data manager does not affect the data load editor script.  I think maybe I didn't hit "Load Data" in the data manager, so the auto-generated script did not reflect the latest state of the data manager.

What really happens:

  1. If you DO NOT associate two tables in the data manager, the relevant fields ARE qualified with the table names in the auto-generated script, MATCHING what is shown in the data manager.
  2. If you DO associate the two tables in the data manager, the relevant fields ARE NOT qualified with the table names in the auto-generated script, CONTRADICTING what is shown in the data manager.


In conclusion:

  1. In the script, field names must be identical to create an association.  Qualifying them with table names prevents it.
  2. Fields that are qualified in the data manager may or may not be qualified in the auto-generated script, according to the two points above.
  3. If you are going to use the data manager (rather than skipping it entirely or unlocking the script it generates), you must associate the tables in the data manager via the magic wand button or drag-and-drops.  There is no way to achieve the association in the data manager by giving fields identical names.

View solution in original post

2 Replies
rittermd
Master
Master

Fields are automatically associated if they have the same names.  That is true.  So if you code your own load script this will occur.

However, if you use the Data Manager to load and associate field they don't have to have the same names exactly.  Qlik will give you options for field that seem to be the same or you can override the associations and create them manually.

I came from using QlikView first which did not have a data manager.  So I coded my load scripts and did everything manually.  Or you can let the data manager generate code and then unlock it and continue doing it manually.  Once you unlock you can't go backwards.

Whatever you do use the Data Model Viewer to see the results of your work and to visually see how your data model is setup and working.

mmarchese
Creator II
Creator II
Author

Okay, reading what you wrote prompted me to take another look at this.  I realized my observation was incorrect that making an association in the data manager does not affect the data load editor script.  I think maybe I didn't hit "Load Data" in the data manager, so the auto-generated script did not reflect the latest state of the data manager.

What really happens:

  1. If you DO NOT associate two tables in the data manager, the relevant fields ARE qualified with the table names in the auto-generated script, MATCHING what is shown in the data manager.
  2. If you DO associate the two tables in the data manager, the relevant fields ARE NOT qualified with the table names in the auto-generated script, CONTRADICTING what is shown in the data manager.


In conclusion:

  1. In the script, field names must be identical to create an association.  Qualifying them with table names prevents it.
  2. Fields that are qualified in the data manager may or may not be qualified in the auto-generated script, according to the two points above.
  3. If you are going to use the data manager (rather than skipping it entirely or unlocking the script it generates), you must associate the tables in the data manager via the magic wand button or drag-and-drops.  There is no way to achieve the association in the data manager by giving fields identical names.