Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted

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

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.

Highlighted
Not applicable

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

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.

Highlighted
Partner
Partner

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

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;

Highlighted

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

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 ...

Highlighted
Not applicable

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

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.

Highlighted

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

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.

Highlighted
Not applicable

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

Hi Peter ,

I got your point  ,...

Thanks,

Charan.