Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I was trying to learn about these concepts in Qlikview, and found some posts on forum, than tried to recreate it myself, and I can make a key to be Primary Key and show it when I hover over in Table Viewer.
Please see the attached QVW.
I made a table, where I am missing one key field, it is NULL (with some resident load conversion from empty string to null).
In table viewer it shows for the field InvoiceID from Invoices Table as KEY
Some sources say that KEY is not unique and appear in multiple rows (which I don't have in my example data). I think it should be Primary Key.
Can someone explain, why is it KEY and not a Primary Key?
Thank you.
That's basically what I tried to express in my previous post.
Key - Keys are NOT unique or some records show NULL
Primary key - Subset ratio is less than 100% AND all records show unique values (i.e. also no NULL)
Perfect key - subset ratio is 100% AND all records show unique values
subset ratio is the share of symbols used in the table compared against all symbols of the key field (looking at all tables)
I think it follows this definition:
A table primary key’s main features are:
A table's key field is in addition a perfect key if the table field values contain all symbol table values of the key field.
Note that the perfect / primary key label is specific to the table when hovering over the column in table view.
edit: not sure if this definition has changed over time with regard to how Qlik uses the labels
This is quite confusing. I am able to get KEY or PERFECT KEY, but not the PRIMARY KEY.
I made it similar as you said, filling the null. I also changed keys so I will not have the perfect sequence (some sources say that perfect key is only for perfect sequence using autonumber). And I still see the Perfect key, even though I did not use autonumber, and I don't have the perfect sequence:
This probably doesn't matter much. I just wanted to know how it works in Qlikview....
But if someone can achieve a PRIMARY KEY label on some example, please post.
Thank you.
Hi Retko,
Most of the time it is not possible to achieve a perfect primary Key, only think you have to make sure is the the master table should have all the key value present with in with respect to other tables it is connected.
Br,
KC
Having perfect key is not depended on sequence or Autonumber.
If your master table and the other supporting table have exactly same unique key values then its subset ration becomes 100% and it will become a perfect key.
Correct me guys if i am wrong
Br,
KC
Just remove the line with the NULL in table Invoices and add a line with a new InvoiceID in InvoiceDetails.
This should make your InvoiceID in Invoices a Primary Key.
Ok, this works.
So I guess this is should be like this:
Perfect key - subset ration is 100% AND all keys are unique.
Key - Keys are NOT unique.
Primary key - Subset ration is less than 100% AND all keys are unique.
Correct?
Thank you.
That's basically what I tried to express in my previous post.
Key - Keys are NOT unique or some records show NULL
Primary key - Subset ratio is less than 100% AND all records show unique values (i.e. also no NULL)
Perfect key - subset ratio is 100% AND all records show unique values
subset ratio is the share of symbols used in the table compared against all symbols of the key field (looking at all tables)
Great, thank you for detailed clarification..
So maybe for the next generations