Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
priyarane
Specialist
Specialist

Mapping load - Synthetic keys

Hi Community,

What was the wrong in the below script as it creating synthetic keys

TRN_TM_RISK_COUNTRY_MAP:
Mapping LOAD
COUNTRY_CODE as T_M_COUNTRY_CODE,
COUNTRY_NAME as T_M_COUNTRY_NAME
From
EXT_COUNTRY.qvd](qvd);


T_TRANSITION_MATRIX:
LOAD *,
ApplyMap('TRN_TM_RISK_COUNTRY_MAP',T_M_COUNTRY_CODE) AS T_M_COUNTRY_NAME;
LOAD %T_M_ID ,
      RISK_COUNTRY AS T_M_COUNTRY_CODE
    
FROM
TRANSITION_MATRIX_*.qvd (qvd) ;

9 Replies
sunny_talwar

Just the above code itself is creating a synthetic key?

maxgro
MVP
MVP

I think you should add the script or a  Qlik doc.

It's difficult to understand where your small piece of code can create a syn key

And you can also read this

Synthetic Keys

MayilVahanan

Hi

From your script, Result will have only one table .

Please provide full script

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
avinashelite

Synthetic key will be formed when the tables are linked with more than one filed ...check the fields in your data model ...using table viewer will help you to identify the Synthetic keys

priyarane
Specialist
Specialist
Author

Hi Sunny,

we have synthetic keys like

Sym.PNG

Anonymous
Not applicable

..or it could fail due to a closing square bracket with no corresponding opening square bracket.

maxgro
MVP
MVP

maybe you can concatenate the 2 transition_matrix tables

avinashelite

Check the

T_TRANSITION_MATRIX table and

CDM_T_TRANSITION_MATRIX_31_Mar-16



the above code is not causing the synthetic key


to avoid the synthetic key , you can rename the fields using as key word


if you want to like the tables with both the fields than build a composite key for the same


LOAD  T_M_ID &'-'& T_M_COUNTRY_CODE  as Key in both the tables and rename all the other fields

MayilVahanan

Hi

Its depends on your data model,

We can remove synthetic key by followings

1. Rename the fields (For Ex: in CDM.Transition_matrix_31_Mar_16, you can rename T_M_Country_Code as CDM_T_M_Country_Code)

2. Create a composite key like %T_M_ID & T_M_Country_Code As %Key in Both Tables and "remove or rename" the common fields

3. You can go with concatenate the both tables

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.