Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Great_to_learn
Contributor
Contributor

Replacing a value in multiple columns

I have two different excel documents, one is a template document with 5 columns showing the desired qvw output format, while the other document has one field which is the customer name.  I am trying to replace the default value(AAA) with the Customer name so I don't have to change this manually from the excel sheet for every customer added. Any ideas on how to go about this?

Below is an example of the two Excel files I have:

Customer NameNumberFileProd NameUser Groups
AAA AAA_EuropeAAA_Europe_ReportEuropeGroup_AAA
AAA AAA_AmericaAAA_America_ReportAmericaGroup_AAA
AAA AAA_AsiaAAA_Asia_ReportAsiaGroup_AAA

 

Customer Name
Customer 1
Customer 2
Customer 3

 

Expected Result:

Customer NameNumberFileProd NameUser Groups
Customer 1 Customer 1_EuropeCustomer 1_Europe_ReportEuropeGroup_Customer 1
Customer 1 Customer 1_AmericaCustomer 1_America_ReportAmericaGroup_Customer 1
Customer 1 Customer 1_AsiaCustomer 1_Asia_ReportAsiaGroup_Customer 1
Customer 2 Customer 2_EuropeCustomer 2_Europe_ReportEuropeGroup_Customer 2
Customer 2 Customer 2_AmericaCustomer 2_America_ReportAmericaGroup_Customer 2
Customer 2 Customer 2_AsiaCustomer 2_Asia_ReportAsiaGroup_Customer 2
Customer 3 Customer 3_EuropeCustomer 3_Europe_ReportEuropeGroup_Customer 3
Customer 3 Customer 2_AmericaCustomer 3_America_ReportAmericaGroup_Customer 3
Customer 3 Customer 3_AsiaCustomer 3_Asia_ReportAsiaGroup_Customer 3

 

Labels (1)
1 Reply
MayilVahanan

Hi @Great_to_learn 

Try like below

TEMP:
LOAD * INLINE [
Customer Name, Number, File, Prod Name, User Groups
AAA, , AAA_Europe, AAA_Europe_Report, EuropeGroup_AAA
AAA, , AAA_America, AAA_America_Report, AmericaGroup_AAA
AAA, , AAA_Asia, AAA_Asia_Report, AsiaGroup_AAA
];

Join
LOAD [Customer Name] AS Customer Inline
[
Customer Name
Customer 1
Customer 2
Customer 3
];


Load
Replace([Customer Name], 'AAA', Customer) as [Customer Name], Number,
Replace(File, 'AAA', Customer) as File, Replace([Prod Name], 'AAA', Customer) as [Prod Name],
Replace([User Groups], 'AAA', Customer) as [User Groups]
Resident TEMP;

DROP Table TEMP;

MayilVahanan_0-1625803834681.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.