Skip to main content
Announcements
Qlik Launches Open Lakehouse and advanced agentic AI experience in Qlik Answers! | LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mohan2391
Creator III

For 1 field - Applymap(), for more than 1 ?

Hi,

I understood clearly that Applymap() is useful when we want to add 1 field/column to other table by keeping 1 reference field (Total 2 fields in mapping table).

I used this in my qvw and worked perfect.

Now i'm in a need that there I want to add 2 fields from 1 table to other big table by keeping 1 reference field (Total 3 fields in mapping table).

How can I achieve this ?

Which function do i need to use ?

Please help me.

Thank You

1 Solution

Accepted Solutions
sunny_talwar

You can create two mapping tables to do this

or you can concatenate the two fields which are going to get mapped into one so for instance

MappingTable:

Mapping

LOAD Field1,

          Field2&'|'&Field3 as Field4

FROM ...

and then when you are mapping them you can use SubField() function to extract them back to there normal value

Fact:

LOAD Field1,

          SubField(ApplyMap('MappingTable', Field1), '|', 1) as Field2,

          SubField(ApplyMap('MappingTable', Field1), '|', 2) as Field3,

          ....

View solution in original post

4 Replies
Mark_Little
Luminary

HI,

Well the first option would be to do two apply maps. One for each extra field.

Or

Look at using Join, Most likely left join.

Mark

sunny_talwar

You can create two mapping tables to do this

or you can concatenate the two fields which are going to get mapped into one so for instance

MappingTable:

Mapping

LOAD Field1,

          Field2&'|'&Field3 as Field4

FROM ...

and then when you are mapping them you can use SubField() function to extract them back to there normal value

Fact:

LOAD Field1,

          SubField(ApplyMap('MappingTable', Field1), '|', 1) as Field2,

          SubField(ApplyMap('MappingTable', Field1), '|', 2) as Field3,

          ....

trdandamudi
Master II

You can split the mapping table into two tables where you have total 3 fields in the mapping table.

For example if you have a mapping table with three fields like below:

ID

Name

Code

Then split them into two mapping tables as below:

Table1:

ID

Name

Table2

ID

Code

Hope this helps...

gireesh1216
Creator III

If u have 3 fields please split to two tables like below.

Example:

Load

Empid,

Name,

Phone_Num

from path;

Table1:

mappling load

Empid,

Name

from path;

Table2:

mappling load

Empid,

Phone_Num

from path;


load

id,

ApplyMap('Table1', Name) as Fieldname,

ApplyMap('Table2', Name) as Field2name

from path;



Thanks

Gireesh

Community Browser