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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
felipe_oliveira
Contributor III
Contributor III

Update field if value matches/exists in other table

Hi masters

I have the following scenario.

Map_Program:

Mapping load * inline [

Program_Code, Program

104, XXXX

111, YYYY

129, ZZZZ

175, WWW

];

Table1:

Load * INLINE [

Location, Segment

AAAA, Direct

BBBB, Direct

CCCC, Direct

DDDD, Direct

EEEE, Direct

FFFF, Direct

];

Table2:

Load Account,

         Customer,

         Program_Name,

         ApplyMap('Map_Program',Program_Name,'Other') as Program,

         Period,

         Location,

         Amount

         Resident DWH;

For the remaining "Other" resulting from the ApplyMap above, I would like to update the Program column (='Direct') if location from Table2 = location from Table1.

How can I do in the load statement?

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Or may be this

Map_Program:

Mapping load * inline [

Program_Code, Program

104, XXXX

111, YYYY

129, ZZZZ

175, WWW

];

Table1:

Load * INLINE [

Location_Name, Segment

AAAA, Direct

BBBB, Direct

CCCC, Direct

DDDD, Direct

EEEE, Direct

FFFF, Direct

];

Table2:

Load Account,

        Customer,

        Program_Name,

        ApplyMap('Map_Program',Program_Name, If(Exists(Location_Name, Location), 'Direct', 'Other')) as Program,

        Period,

        Location,

        Amount

Resident DWH;

View solution in original post

4 Replies
sunny_talwar

May be this

Map_Program:

Mapping load * inline [

Program_Code, Program

104, XXXX

111, YYYY

129, ZZZZ

175, WWW

];

Table1:

Load * INLINE [

Location, Segment

AAAA, Direct

BBBB, Direct

CCCC, Direct

DDDD, Direct

EEEE, Direct

FFFF, Direct

];

Table2:

Load Account,

        Customer,

        Program_Name,

        ApplyMap('Map_Program',Program_Name, If(Exists(Location), 'Direct', 'Other')) as Program,

        Period,

        Location,

        Amount

Resident DWH;

sunny_talwar

Or may be this

Map_Program:

Mapping load * inline [

Program_Code, Program

104, XXXX

111, YYYY

129, ZZZZ

175, WWW

];

Table1:

Load * INLINE [

Location_Name, Segment

AAAA, Direct

BBBB, Direct

CCCC, Direct

DDDD, Direct

EEEE, Direct

FFFF, Direct

];

Table2:

Load Account,

        Customer,

        Program_Name,

        ApplyMap('Map_Program',Program_Name, If(Exists(Location_Name, Location), 'Direct', 'Other')) as Program,

        Period,

        Location,

        Amount

Resident DWH;

its_anandrjs
Champion III
Champion III

Few questions

1. In Program_Name what is the data it is code or Program name

2. After apply mapping Programe name = location if it is then try this



Table1:

Mapping

Load * INLINE [

Location, Segment

AAAA, Direct

BBBB, Direct

CCCC, Direct

DDDD, Direct

EEEE, Direct

FFFF, Direct

];

ApplyMap('Map_Program',Program_Name,ApplyMap('Table1',Location)) as Program,

felipe_oliveira
Contributor III
Contributor III
Author

Thanks Sunny! It worked perfectly!