Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Help needed in writing script

Hi I have script like after resident load 2 table

Table1:

LOAD Country,

          Branch,

          sales

          Week,

          month,

          Year

Resident tab:

Table2:

LOAD Country,

          Branch,

          Week,

          month,

          Year

Resident tab2:

Here i need do left join to Table1 and If Country and Branch and Week and Month and Year not matched with Table1 then i need to show for sales as 0 otherwise 1.Could you please help on Script part because i not able put condition for sales due to resident load.

Thanks,

Rajesh

1 Solution

Accepted Solutions
stabben23
Partner - Master
Partner - Master

Hi Rajesh,

instead of left join use applymap.

Table2:

Mapping LOAD

Country& Branch & Week & month & Year as %MapKey,

'1' as mapvalue

Resident tab2;

Table1:

LOAD Country,

          Branch,

          sales,

         applymap('Table2',Country& Branch & Week & month & Year,0) as salesFlag,

          Week,

          month,

          Year

Resident tab;

View solution in original post

7 Replies
stabben23
Partner - Master
Partner - Master

Hi Rajesh,

instead of left join use applymap.

Table2:

Mapping LOAD

Country& Branch & Week & month & Year as %MapKey,

'1' as mapvalue

Resident tab2;

Table1:

LOAD Country,

          Branch,

          sales,

         applymap('Table2',Country& Branch & Week & month & Year,0) as salesFlag,

          Week,

          month,

          Year

Resident tab;

Anonymous
Not applicable
Author

Thanks for revert back Staffan..Can i defined in resident load for Key like without defining columns,

Table2:

Mapping LOAD

Country& Branch & Week & month & Year as %MapKey,

'1' as mapvalue

Resident tab2;

In above code Country& Branch & Week & month & Year as %MapKey, can we define because first we need to include those columns in LOad it self .

Thanks,

Rajesh

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Resident for Applymap should work.

stabben23
Partner - Master
Partner - Master

If you have the key from tab2 you just use it.

tab2:

Load

Country& Branch & Week & month & Year as %MapKey,

..

...

..

from ........

mapping Load

%MapKey

'1' as mapvalue

Resident tab2;

Anonymous
Not applicable
Author

Yes that's fine but when ever you defining %MapKey, value in any load first you need to keep the columns and create %MapKey,.Here key created  directly with out colums for the frist time .

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

In case you're using Applymap and loading data as Resident you need to have the columns from which you creating the %MapKey or else already have created the %MapKey as stabben23 suggested.

Anonymous
Not applicable
Author

Thanks Staffan it's working fine