Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
raghuvr33
Contributor III
Contributor III

Modelling with 2 cols as unique record for every table

Hi All,

We have data from 2 different databases for the same set of tables. Need to identify each row of data with a databasebid along with primary key for each table. For example Orders table need to have dbid and orderid fields identifying a unique record. How to model in such scenarious?
Am new to Qlikview and understand they recomend to have only one common field between tables and also avoid synthetic Keys.

Thanks in advance for your help.

3 Replies
MarcoWedel

You could create a combined key using autonumberhash128(id1, id 2)

simondachstr
Luminary Alumni
Luminary Alumni

Create a key using those two id's while loading:

LOAD *,

dbid & '_' & orderid AS Unique_key

QlikView will then connect the tables based on that key. The above key though being a string is very calculation intensive, which is why you might want to use e.g. the AutoNumber()  functionality to enhance performance.

raghuvr33
Contributor III
Contributor III
Author

Thanks for your quick response to my question. Every table is common to both databases and we have a need to analyze based on data in one database and at times in both databases making it consolidated (that is data for both combined). The orders table along with Orderid has account code, subaccount code, project code which all need to be linked to separate tables  like accounts,subaccounts ,projects . Question is

1. AS Unique_key - Will this create a column with Unique_Key as name of the column?

2. Should columns like account code  be combined as recommended above to connect to the accounts table ?

3.  How to use autonumber() when creating a combined key and will the number generated affect the join ?