Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

Link several tables with primary and foreign keys

Hi everyone, I have a basic doubt, first of all I have several tables that I have extracted from an excel file but these tables doesn't have Id fields in order to related between then so I decided to create these id fields, but how I can link one table with another. For example 

Table A,

primary key 

Table B

primary key

foreign key

 

how to set my primary key in the table A to the tabla B? 

6 Replies
Highlighted
Specialist
Specialist

Re: Link several tables with primary and foreign keys

Qlik will join tables based on field names and Qlik is case sensitive.  If the primary key for Table A was DEPTID and the primary key for Table B was DEPTID, Qlik would join the tables on DEPTID.

Highlighted
Partner
Partner

Re: Link several tables with primary and foreign keys

I did what you mention but the problem is that I have many tables with the same key, and my model shows like this:  

TABLE A

ID_CAR

 

TABLE B

ID_CAR

 

TABLE C

ID_CAR

 

Highlighted
Specialist
Specialist

Re: Link several tables with primary and foreign keys

Hi @Luis_Fer0812 

What you do in these scenarios is create on alias for the conflicting column, by example

TABLE A
ID_CAR   As CAR_ID

TABLE B
ID_CAR   As B_CAR_ID

TABLE C
ID_CAR   As CAR_ID

TABLE D
ID_CAR   As D_CAR_ID

Tables A and C share the same CAR_ID column, then Qlik join them, while Tables B and D (and any other table) have their own CAR_ID column, if you do not like so many aliases, you can also use Qualify  to eliminate synthetic keys and your resolving the joins by renaming the required columns to a common name.

Hope this helps, 

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
Highlighted
Partner
Partner

Re: Link several tables with primary and foreign keys

Maybe I did not explained very well, but the thing that I want is to load a Primary Key in another table, for example:

table CLIENT

ID_CLIENT

-

-

-

 

table ORDER

ID_ORDER

-

-

ID_CLIENT (I want lo load this field in this table)

 

I want to do in order to related them.

 

Highlighted
Specialist
Specialist

Re: Link several tables with primary and foreign keys

Hi @Luis_Fer0812 

Well, we will expect that to be a common field between Orders and Customers; How are Customers and Orders associated in the current application, prior to getting its data in Qlik's QVDs; How are they join at the backend database?

HTH

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
Highlighted
Partner
Partner

Re: Link several tables with primary and foreign keys

Ok thanks, now I understand that the tables need to be related according to the common fields amount them. I thought that making an ID field was the only way to relate tables.