Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Mapping table in Qlik Sense Merging tables with different attributes

Hello.

I have two tables and one problem to solve. I need to attribute Key1 to Name somehow. I quite newbie in qlik products so even if solution is obvious, for me it is something new to lear.

Table1.

Name
Alpha
Beta
Gamma
Delta
Epsilon
Zeta

Table2.

Key1Value
0011001
002354
003544
AC2354
A0T5453
AC2545
00268
004787
002336

I need to attribute Name to Keys for example in this way:

Alpha = 001

Beta = AC2

Gamma = 003

Atc...

7 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

The data in your post does not have enough information for you to do this.

How does the script know that Beta = AC2?

And Gamma = Epsilon (Epsilon is not even a key - is that a typo)?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Gamma = 003 (already corrected, thank you)

This is my question. How to write it in Qlik script to attribute these tables correctly?

Mark_Little
Luminary
Luminary

Hi,

The only ways I can suggest with what is posted is to have a if statement on load or making an apply map.

IF ( Name = 'Alpha', '001'

          IF(Name ='Beta', 'AC2'

               IF(......

                    )

               )

     ) as Key1

Mark

Anonymous
Not applicable
Author

Mark, Thank you for advise, it actually works with if statement, but these tables are quite long, so i need faster way. I've seen a few examples of using map function but i connot figure out how to use it in my case.

Mark_Little
Luminary
Luminary

HI,

We create an inline table with your Name and Key1

As Something like

Table1:

LOAD * INLINE [

    Name, Key1

    Alpha, 001

  ...., ...

];

MapTable:

Mapping Load

     Name,

     Key1

Resident Table1;

Drop Table Table1;

Load

     Name,

     ApplyMap('MapTable',Name) as Key1

From 'Your location'

Hope this helps

Mark

raju_insights
Partner - Creator III
Partner - Creator III

Hi Kamil,

As Jonathan said, u need to give some more details. For example, from table 1 and table 2 you have provided, how you are saying that Beta = AC2.

I guess we are missing that link.

How 'Name' from Table1 is linked with 'Key1' of Table2 ?

Josh_Good
Employee
Employee

This version of Mark's approach would be slightly more efficient because you can doing a mapping load with an inline load

MapTable:

Mapping LOAD * INLINE [

    Name, Key1

    Alpha, 001

  ...., ...

];

Load

     Name,

     ApplyMap('MapTable',Name) as Key1

From 'Your location'

-Josh

Qlik