Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reg:How to avoid Synthetic Keys

Hi All,

In my QVW''s I am having more number of synthetic keys.Though it is unavoidable in QV,I want to minimize number of synthetic keys in my application.Is there is any possible way available to reduce,let me know the same.

Thanks&Regards

Jai

5 Replies
Not applicable
Author

I use the functions like Hash128.

Hash128(Field1, Field2) as Key

happydays1967
Creator
Creator

Make sure filednames are unique if you don't want QlikView to link on those fileds. Qlikview automatically join two tables on fields with identical (case sensitive!) filednames. Synthetic keys (in my experience) start happening when you have two or more tables that have a number of fields with identical names. QlikView then assumes you want to link those tables, and does so by creating synth keys. It is good practice to avoid this at all times, because it may also cause undesired effects in your analyses. another scenario is when you would like to have a union between tables, but the tables do not contain the same number of fields. QlikView then produces TableName;TableName_1 and a synthetic key (or -table) with all corresponding fields.

We usually use AutoNumber(field & field & ......,'ListName') as "keyname" to link tables, and avoid using identical fieldnames.

Success!

Miguel_Angel_Baeyens

Hello,

When loading tables from any source, I'm using

Autonumber('TABLENAME ' & FieldName) AS QlikViewFieldName


so you can avoid generating same code from different fields witht the same value, and likewise using, if needed in your project, the string 'TABLENAME ' to identify where the field comes from easier in your script.

Hope this helps!

Miguel Angel

Not applicable
Author

Give a look: http://michaelellerbeck.com/2008/08/22/qlikview-synthetic-keys/

But, I suggest to use functions like (autonumber, hash), how suggested for all.

Not applicable
Author

Create a composite Key using the common fields in both the tables ... In my Example Month,State,Location,City is

common and I created them as Customer_Key(Composite Key name ) for my reference.. 

Avoid Synthetic Key.JPG

I think this may help you..