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: 
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

1 Solution

Accepted Solutions
Saravanan_Desingh

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

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