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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

Case 309 How to create one expression to replace multiple expression ?

Hi All

I have below script work fine , except for the red color expression not working :-

MAP_NAME_A:
mapping LOAD RAW,
NAME
FROM
[MAP_A.xlsx]
(ooxml, embedded labels, table is MAP_A);

MAP_NAME_B:
mapping LOAD RAW,
NAME
FROM
[MAP_B.xlsx]
(ooxml, embedded labels, table is MAP_B);

For Each i in 'A','B'

LOAD
COY,
SALESMAN,
'$(i)' as SOURCE,

ApplyMap('MAP_NAME_A',[SALESMAN],'OTHERS') as [SALESMANE_A],
ApplyMap('MAP_NAME_B',[SALESMAN],'OTHERS') as [SALESMANE_B],

ApplyMap('MAP_NAME_'$(i)'',[SALESMAN],'OTHERS') as [SALESMANE],

SALES
FROM
COY_$(i).xlsx (ooxml, embedded labels, table is COY_$(i));
NEXT i;

Hope some one can advise me how to do it ?

I get below error msg :-

Error in expression:
')' expected
LOAD

The final result :-

final result master.png

Labels (1)
1 Solution

Accepted Solutions
Saravanan_Desingh
MVP
MVP

ApplyMap('MAP_NAME_$(i)',[SALESMAN],'OTHERS') as [SALESMANE],

Remove single quote around $(i). Within a String, if you use $, the variable will be automatically replaced with the value.

View solution in original post

2 Replies
Saravanan_Desingh
MVP
MVP

ApplyMap('MAP_NAME_$(i)',[SALESMAN],'OTHERS') as [SALESMANE],

Remove single quote around $(i). Within a String, if you use $, the variable will be automatically replaced with the value.

paulyeo11
Master
Master
Author

Hi Sir

Many thank it work fine now .

Paul