Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

klewandowski
New Contributor III

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

Re: Mapping table in Qlik Sense Merging tables with different attributes

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)?

klewandowski
New Contributor III

Re: Mapping table in Qlik Sense Merging tables with different attributes

Gamma = 003 (already corrected, thank you)

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

mark6505
Valued Contributor III

Re: Mapping table in Qlik Sense Merging tables with different attributes

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

klewandowski
New Contributor III

Re: Mapping table in Qlik Sense Merging tables with different attributes

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.

mark6505
Valued Contributor III

Re: Mapping table in Qlik Sense Merging tables with different attributes

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
Contributor III

Re: Mapping table in Qlik Sense Merging tables with different attributes

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 ?

Employee
Employee

Re: Mapping table in Qlik Sense Merging tables with different attributes

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

Community Browser