Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

Script Doubt

Hey,

I have a script:

Load

SalesPersonId,

Applymap('Table1' , SalesPersonId , 'Unknown') as SalesPersonName,

concat

Applymap('Table2' , SalesPersonId , 'Unknown') as SalesPersonName,

desk ;

I ahve Salespersonname coming form table 1 and table2 so can i concat like above script to get a single field SalesPerson with values from both table1 and table 2??

Thanks

15 Replies
MK_QSL
MVP
MVP

Table1:

Mapping Load SalesPersonId, SalesPersonName From TableName;

Table2:

Mapping Load SalesPersonId, SalesPersonName From TableName;

Final:

Load

     SalesPersonId,

     Applymap('Table1' , SalesPersonId , 'Unknown') as SalesPersonName

FromTableName2:

Concatenate

Load

     SalespersonId,

     Applymap('Table2' , SalesPersonId , 'Unknown') as SalesPersonName,

From TableName3;

anbu1984
Master III
Master III

Load

SalesPersonId,

Applymap('Table1' , SalesPersonId , 'Unknown')  & '-' & Applymap('Table2' , SalesPersonId , 'Unknown') as SalesPersonName,

desk ;

nikhilgarg
Specialist II
Specialist II
Author

i dont think this will work becoz in this case 2 cases can be:

Unkknown-SalesPersonNAme and SalesPErsonName-Unknown

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Yes

Load SalesPersonId,

     Applymap('Table1' , SalesPersonId , 'Unknown') & ',' &

     Applymap('Table2' , SalesPersonId , 'Unknown') as SalesPersonName,

     desk ;

anbu1984
Master III
Master III

So you will get SalespersonName from only one of tables?

If(Applymap('Table1' , SalesPersonId , 'Unknown') = 'Unknown',

Applymap('Table2' , SalesPersonId , 'Unknown') & '-Unknown',

If(Applymap('Table2' , SalesPersonId , 'Unknown') = 'Unknown',

Applymap('Table1' , SalesPersonId , 'Unknown') & '-Unknown',

Applymap('Table1' , SalesPersonId ) & '-' & Applymap('Table2' , SalesPersonId)) as SalesPersonName

nikhilgarg
Specialist II
Specialist II
Author

Hey,

I want that is salespersonid is present in Table1 then it should place SalesPErsonName corresponding to it else if not then ,

if it is present in table2 then it should place SalesPErsonName corresponding to it else if not then , Unknow.

Can you pls tell the whole script.

Thanks

anbu1984
Master III
Master III

If(Applymap('Table1' , SalesPersonId , 'Unknown') <> 'Unknown',

Applymap('Table1' , SalesPersonId ),

If(Applymap('Table2' , SalesPersonId , 'Unknown') <> 'Unknown',

Applymap('Table2' , SalesPersonId),'Unknown')) as SalesPersonName

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Or even simpler/more compact:

:

Applymap('Table1' , SalesPersonId , Applymap('Table2' , SalesPersonId, 'Unknown')) as SalesPersonName

;

nikhilgarg
Specialist II
Specialist II
Author

Thanks peter. It should work