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

Can we link 2 tables with different column names with out renaming column name ?

Hello,

In qlikview if the two tables column name is same then system will automatically create a link then what about if the two tables has different column names but the data is same ?

Assume below are the two tables and below of them are column names:

Sales(table):

Product_key,

sales_id,

customer_id,

sale_Date,

amount,

qty

Product(table):

Product_id,

Product_name,

Mfg_Date,

Product_type,

Color

The above two tables has column name called product_id(from product table) and product_key(from sales table). Logically both are connected but if we load these 2 tables

system will not auto link these tables due to different names.

Could any one please tell me how to connect these 2 tables with out changing the column names ?

Thanks in Advance,

Charan.

7 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

When loading the Sales table, create a copy of the Product_key field and call it product_id. That way, you won't rename the original and you'll still enjoy the full speed and comfort of the associative engine.

Not applicable
Author

Hi Peter,

Are you saying in the below format ? (by using as key word after the column ? )

Directory;

LOAD

Product_key  as product_id , // by using as key word ?

sales_id,

customer_id,

sale_Date,

amount,

qty

FROM

[..\Downloads\Build_Your_First_QlikView_exercise_files\Build you first QlikView document _Exercises\DATA\SALES.xls]

(biff, embedded labels, table is DIVISION$);

Thanks,

Charan.

albertovarela
Partner - Specialist
Partner - Specialist

Sales:

  LOAD

  Product_key as %Product_Id, //Key

  Product_key,

  sales_id,

  customer_id,

  sale_Date,

  amount,

  qty

FROM Sales_Table;

Product:

LOAD

  Product_id as %Product_Id, //Key

  Product_id,

  Product_name,

  Mfg_Date,

  Product_type,

  Color

FROM Product_Table;

Peter_Cammaert
Partner - Champion III
Partner - Champion III

No because you are now renaming the Product_key field, and you stated that you don't want to do that. Better do something like this:

LOAD

Product_key  as product_id , // Yes, by using AS key word but only on a copy of the field

Product_key, // This one stays where it was

sales_id,

customer_id,

sale_Date,

amount,

qty

FROM ...

Not applicable
Author

Hi Peter/Alberto,

Thanks for spending your valuable time on this question.

I know by using the "as" key word but I feel this is not the correct way because this is changing the column name.

My question is with out renaming the column cant we create the link between 2 tables?

Don't  we any additional script to achieve this ?

Thanks,

Charan.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

You are not renamling any of the original fields, you're just creating copies of one field (in my example) or two fields (in Alberto's example) to kick the associative engine into action. As requested by you, the original fields keep their names.

The added advantage of Alberto's example is that a field name prefixed with a % character will be hidden from your UI objects. It is a best practice to not use link fields in User Interface Objects.

Not applicable
Author

Hi Peter ,

I got your point  ,...

Thanks,

Charan.