Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
qvqfqlik
Creator
Creator

Synthetic keys forming- please help

synthetic keys getting created.

however, the script ran fine.

Please help.

5 Replies
mgranillo
Specialist
Specialist

A synthetic key is okay depending on your use case.  If you want to remove it, concatenate the fields in your synthetic key and remove or rename the fields.

qvqfqlik
Creator
Creator
Author

In the file i sent and from the synthetic key key message, how do i concatenate?

karthikoffi27se
Creator III
Creator III

Hi Prithvi

The best solution to overcome synthetic key is follow any one of these steps based on your requirement.

$SYNTHETIC KEY

PRODUCT_KEY+FIXED_COST+VARIABLE_COST+TOTAL_COST



1. You can rename the field names


 SalesTable:

Load

PRODUCT_KEY,

FIXED_COST as SALES_FIXED_COST,

VARIABLE_COST as SALES_VARIABLE_COST,

TOTAL_COST AS SALES_TOTAL_COST

From Sales.qvd

;

CostTable:

Load

PRODUCT_KEY,

FIXED_COST as COST_FIXED_COST,

VARIABLE_COST as

 COST_VARIABLE_COST,

TOTAL_COST AS COST_TOTAL_COST

From Cost.qvd

;


2. You can remove or comment the common field names apart from primary key.


SalesTable:

Load

PRODUCT_KEY,

FIXED_COST,

VARIABLE_COST,

TOTAL_COST

From Sales.qvd

;

CostTable:

Load

PRODUCT_KEY,

//FIXED_COST

//VARIABLE_COST

//TOTAL_COST

From Cost.qvd

;


3. The final option is to use the Qlik function qualify and unqualify

Qualify function will add the table name in front of your field names 


Qualify *;

Unqualify PRODUCT_KEY;


SalesTable:

Load

PRODUCT_KEY,

FIXED_COST,

VARIABLE_COST,

TOTAL_COST

From Sales.qvd

;

CostTable:

Load

PRODUCT_KEY,

FIXED_COST,

VARIABLE_COST,

TOTAL_COST

From Cost.qvd

;


Unqualify *;


Hope this should resolve your problem.


Many Thanks

Karthik

Clever_Anjos
Employee
Employee

Your file came empty

qvqfqlik
Creator
Creator
Author

Synthetic key here is not due to this piece of code... I fixed it... Thanks for looking into.