Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Synthetic key help

I'm currently trying to build a dynamic dashboard (that is, clicking on one table affects the other table). I've uploaded the information for each individual table into one excel file and loaded them on separately. The script is as follows:


Hobbies:
CrossTable(Hobbies, Data, 3)
LOAD respid,
Country,
Cluster,
q12_1,
q12_2,
q12_3,
q12_4,
q12_5,
q12_6,
q12_7,
q12_8,
q12_9,
q12_10,
q12_11,
q12_12,
q12_13,
q12_14,
q12_15,
q12_16,
q12_17,
q12_18,
q12_19,
q12_20
FROM

(
ooxml, embedded labels, table is Sheet1);

Values:
CrossTable(Values, Data, 3)
LOAD respid,
Country,
Cluster,
q11_1,
q11_2,
q11_3,
q11_4,
q11_5,
q11_6,
q11_7,
q11_8,
q11_9,
q11_10,
q11_12,
q11_13,
q11_15,
q11_16,
q11_17,
q11_18,
q11_19,
q11_20,
q11_21,
q11_22,
q11_23,
q11_24,
q11_25,
q11_26,
q11_28,
q11_30,
q11_31,
q11_32,
q11_33,
q11_35,
q11_36,
q11_37,
q11_38
FROM

(
ooxml, embedded labels, table is Sheet1);


Now on the front end, the tables are doing what I need them to do, so clicking on information in one box affects the other one. However, there is a synthetic key that has been created of (respid, country, cluster and data). While I know I want the tables to be linked, I don't know how to remove the synthetic key while maintaining a relationship to the other questions.


How should I go about linking the data but without a synthetic key being formed?


Thanks in advance.

7 Replies
qlikview979
Specialist
Specialist

Hi,

Please share Your source file.

florentina_doga
Partner - Creator III
Partner - Creator III

load first table and create key like this

respid &'|'&   Country &'|'&   Cluster&'|'&Date as key.

load second table and create key like this

respid &'|'&   Country &'|'&   Cluster&'|'&Date as key. but fields respid ,  Country ,   Cluster, Date rename like this

load respid as respid2,

Country as Country2,

Cluster as Cluster2,

date as date2

florentina_doga
Partner - Creator III
Partner - Creator III

add to your script at final

concatenate(Hobbies)

load * resident Values;

drop table Values;

NoConcatenate

final:

load *,

if(len(Hobbies)<>0,Hobbies,if(len(Values)<>0,Values)) as Hobbies_Values

resident Hobbies;

drop table Hobbies;

Anonymous
Not applicable
Author

Hi Tanya,

Use this code, I've created a new field that sais if record is hobbie or is value. Regards!

Hobbies:

CrossTable(Values, Data, 4)

LOAD respid,

Country,

Cluster,

'Hobbies'    as Type,

q12_1,

q12_2,

q12_3,

q12_4,

q12_5,

q12_6,

q12_7,

q12_8,

q12_9,

q12_10,

q12_11,

q12_12,

q12_13,

q12_14,

q12_15,

q12_16,

q12_17,

q12_18,

q12_19,

q12_20

FROM

[q12.xlsx]

(ooxml, embedded labels, table is Sheet1);

Values:

CrossTable(Values, Data, 4)

LOAD respid,

Country,

Cluster,

'Values'    as Type,

q11_3,

q11_4,

q11_5,

q11_6,

q11_7,

q11_8,

q11_9,

q11_10,

q11_12,

q11_13,

q11_15,

q11_16,

q11_17,

q11_18,

q11_19,

q11_20,

q11_21,

q11_22,

q11_23,

q11_24,

q11_25,

q11_26,

q11_28,

q11_30,

q11_31,

q11_32,

q11_33,

q11_35,

q11_36,

q11_37,

q11_38

FROM

[q11.xlsx]

(ooxml, embedded labels, table is Sheet1);

Anonymous
Not applicable
Author

If you wanna ir separatelly, then:

Hobbies:

CrossTable(Hobbies, DataHobbies, 1)

LOAD

AutoNumberHash128(respid&'-'&Country&'-'&Cluster) as KeyHobbies,

q12_1,

q12_2,

q12_3,

q12_4,

q12_5,

q12_6,

q12_7,

q12_8,

q12_9,

q12_10,

q12_11,

q12_12,

q12_13,

q12_14,

q12_15,

q12_16,

q12_17,

q12_18,

q12_19,

q12_20

FROM

[q12.xlsx]

(ooxml, embedded labels, table is Sheet1);

Values:

CrossTable(Values, DataValues, 1)

LOAD AutoNumberHash128(respid&'-'&Country&'-'&Cluster) as KeyValues,

q11_3,

q11_4,

q11_5,

q11_6,

q11_7,

q11_8,

q11_9,

q11_10,

q11_12,

q11_13,

q11_15,

q11_16,

q11_17,

q11_18,

q11_19,

q11_20,

q11_21,

q11_22,

q11_23,

q11_24,

q11_25,

q11_26,

q11_28,

q11_30,

q11_31,

q11_32,

q11_33,

q11_35,

q11_36,

q11_37,

q11_38

FROM

[q11.xlsx]

(ooxml, embedded labels, table is Sheet1);

Key:

LOAD respid,

     Country,

     Cluster,

     AutoNumberHash128(respid&'-'&Country&'-'&Cluster) as KeyValues,

     AutoNumberHash128(respid&'-'&Country&'-'&Cluster) as KeyHobbies

FROM

q11.xlsx

(ooxml, embedded labels, table is Sheet1);

LOAD respid,

     Country,

     Cluster,

     AutoNumberHash128(respid&'-'&Country&'-'&Cluster) as KeyValues,

     AutoNumberHash128(respid&'-'&Country&'-'&Cluster) as KeyHobbies

FROM

q12.xlsx

(ooxml, embedded labels, table is Sheet1);

jonas_rezende
Specialist
Specialist

Hi, Tanya Vaidya.

Try this:

Temp_Hobbies:
CrossTable(Hobbies, Data, 3)
LOAD respid,
Country,
Cluster,
q12_1,
q12_2,
q12_3,
q12_4,
q12_5,
q12_6,
q12_7,
q12_8,
q12_9,
q12_10,
q12_11,
q12_12,
q12_13,
q12_14,
q12_15,
q12_16,
q12_17,
q12_18,
q12_19,
q12_20
FROM

(
ooxml, embedded labels, table is Sheet1);


NoConcatenate

Hobbies:

LOAD

Autonumber(respid & '_' & Country & '_' & Cluster & '_' & Data) AS %Key,

*

Resident Temp_Hobbies;

drop table Temp_Hobbies;

Temp_Values:
CrossTable(Values, Data, 3)
LOAD respid,
Country,
Cluster,
q11_1,
q11_2,
q11_3,
q11_4,
q11_5,
q11_6,
q11_7,
q11_8,
q11_9,
q11_10,
q11_12,
q11_13,
q11_15,
q11_16,
q11_17,
q11_18,
q11_19,
q11_20,
q11_21,
q11_22,
q11_23,
q11_24,
q11_25,
q11_26,
q11_28,
q11_30,
q11_31,
q11_32,
q11_33,
q11_35,
q11_36,
q11_37,
q11_38
FROM

(
ooxml, embedded labels, table is Sheet1);

NoConcatenate

Values:

LOAD

Autonumber(respid & '_' & Country & '_' & Cluster & '_' & Data) AS %Key,

Values

Resident Temp_Values;

DROP Table Temp_Values;

Hope this helps!

muthukumar77
Partner - Creator III
Partner - Creator III

Hi,

You can use Concatenate between two tables. Because of those tables field name is same.

Muthukumar Pandiyan