Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Mapping


Hi,

I am using the following logic and need to get Branch and Region. I tried to use Maps but only two coloumns logic can be used in it. Here, I have to use four coloumns logic if I want to get Branch or Region. Any idea how can resolve this issue?

NSCCREATED_BY_STAFF_IDSrce_NameBranchRegion
937452 Tuam RoadMidwest
937436 Newcastle RoadMidwest
930148 CastletroyMidwest
937401 SalthillMidwest
937150 TuamNorth_West
936138 MacroomSouth_West
934194 Western RoadCork_Central
930105 DirectDirect
93010510000 Online - Internet BankingOnline - Internet Banking
930105 InternetOnline - WebOnline - Web
1 Solution

Accepted Solutions
Roop
Specialist
Specialist

NSC:

LOAD

     NSC,    

     Region,    

     Branch

FROM NSC.xlsx (ooxml, embedded labels, table is Sheet1);

MapBranch:

Mapping Load    

     NSC,    

     Branch

     Resident NSC;

MapRegion:

Mapping Load   

     NSC,   

     Region

     resident NSC;

MainData:

     LOAD

     Application_Id,    

     NSC,    

     Originating_User_Id,

     if(NSC= '930105',   

          if(Originating_User_Id = '58900',         

               'Online - Internet Banking' ,         

               if(Srce_Name = 'INTERNET' ,             

                    'Online - Web' ,             

                    if(Originating_User_Id <> '58900',                   

                         'Direct',                   

                         'Unknown Non-Branch'            

                    )

               )

          ),  

          ApplyMap( 'MapBranch',NSC,'Unknown Branch')

      ) as Branch,

     if(NSC= '930105',   

          if(Originating_User_Id = '58900',         

               'Online - Internet Banking' ,         

               if(Srce_Name = 'INTERNET' ,             

                     'Online - Web' ,             

                    if(Originating_User_Id <> '58900',                   

                         'Direct',                   

                         'Unknown Non-Region'             

                    )         

               )   

          ), 

          ApplyMap( 'MapRegion',NSC,'Unknown Region')

      ) as Region,    

     Srce_Name

FROM maindata.xlsx (ooxml, embedded labels, table is Sheet1);

From your data that you supplied and it works

View solution in original post

22 Replies
Gysbert_Wassenaar

Create a key field from the three fields:

Temp:

load NSC, CREATED_BY_STAFF_ID, Srce_Name, Branch, Region,

autonumber(NSC & CREATED_BY_STAFF_ID & Srce_Name,'KeyIndex') as Key

from ...;

You can then use the Key field for the maps.

MapBranch:

Mapping Load Key, Branch

resident Temp;

MapRegion:

Mapping Load, Key, Region

resident Temp;

drop table Temp;


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

Thanks, I used:

load NSC, CREATED_BY_STAFF_ID, Srce_Name, Branch, Region,

autonumber(NSC & CREATED_BY_STAFF_ID & Srce_Name,'KeyIndex') as Key

from .....

in the code and used the following in Maps but did not work. Could you please explain which code where should use

MapBranch:

Mapping Load Key, Branch

resident Temp;

MapRegion:

Mapping Load, Key, Region

resident Temp;

drop table Temp;

Gysbert_Wassenaar

I assumed you were talking about mapping tables and the applymap function. Please look them up in the help file. If those are not what you need please explain what you are trying to do.


talk is cheap, supply exceeds demand
Not applicable
Author


I have thousands of applications data created through these above channels. There are three input coloumns i.e, NSC, Created_By_Staff_Id and Srce_Name. I want to get Branch and Region based on these coloumns criteria as the logic used above. I will use branch and region for drawing graphs and table etc..

Not applicable
Author

One file shows the input data for three colomns NSC, Created_By_Staff_Id and Srce_Name with other colomns like Application_Id etc.....Another file shows  the logic which should be used for getting Branch and Region. Now any idea to get Region and Branch please

Gysbert_Wassenaar

I still don't understand what you're trying to do. Can you post examples of your tables and what the end result should look like?


talk is cheap, supply exceeds demand
Roop
Specialist
Specialist

I think that you are missing the final step:

Leave the Mapping Load statements as these just create the ability to look up the values from the tables.

To create Branch & Region in the script:

FinalAnswer:

Load *,

ApplyMap('MapBranch',Key,'No Branch Available') as Branch,

ApplyMap('MapRegion', Key, 'No Region Available') as Region

Resident MainLoad;

Drop Table MainLoad;

where MainLoad is where you have your main data loaded - and that should provide your answer.

Not applicable
Author


Hi Gysbert,

Sorry, I have the following data:

Application_IdNSCOriginating_User_IdSrce_Name
1776499693010573445CALL                         
1793367393010573352INTERNET                     
1747015593010573422PREV CUSTOMER                
1015957993010573339INTERNET                     
1007621093010558900                             
1255537893010558900                             
1539985493010558900                             
1876714593010558900                             
1398718093010558900                             
135862339323459964
1410267293515859227
1261511093242650383
1786742093104713044
1982467393106386198
1419781493734715498
1900321893621920202
1978270793638360458
1572075093104713044
1234567893551482057

I need to use the following logic to get Online - Internet Banking, Online – Web, Direct and Branch.

Nsc = '930105' AND Created_by_Staff_Id = '58900' THEN 'Online - Internet Banking'

Nsc = '930105' AND Srce_Name = 'INTERNET' then 'Online - Web'

Nsc = '930105' AND Created_by_Staff_Id NOT= '58900' THEN 'Direct'

Nsc NOT = '930105' THEN 'Branch'

I have a list of NSC which shows what’s the Branch name and Region of a particular NSC as below. Problem is only if NSC = 930105 because this NSC could be Online - Internet Banking, Online – Web or Direct based on the above logic.

NSC

Region

Branch

937150

North_West

Tuam

937274

North_West

Tubbercurry

937169

North_West

Westport

934402

South_East

Ardkeen

933023

South_East

Arklow

935042

South_East

Cahir

935050

South_East

Carrick-on-Suir

935069

South_East

Cashel

I want to draw a table showing no of applications received through Online - Internet Banking, Online – Web, Direct and Branch/Region. Thanks

Roop
Specialist
Specialist

Create 4 different Mapping Loads:

1 for Online Internet Banking

1 for Online Web

1 for Direct

1 for Branch

and nest them

so the code will look something like:

ApplyMap('InternetMap', InternetKey, ApplyMap('WebMap', WebKey, ApplyMap('DirectMap', DirectKey, ApplyMap('BranchMap', BranchKey, 'Unknown Branch')))) as Source

Hope this helps