Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Change field name and values

I have the field PharmacyName that I want to change to PharmacyDemo as follows.

PharmacyName     change to      PharmacyDemo

PharmacyA           change to      Pharmacy1

PharmacyB           change to      Pharmacy2

PharmacyC           change to      Pharmacy3

PharmacyName is a field that already exists in the model.

PharmacyDemo does not exist in the model

How can I do this?

6 Replies
Gysbert_Wassenaar

Anonymous
Not applicable
Author

so I have this in my script

DemoMapping:

Mapping LOAD PharmacyName, PharmacyDemo

FROM

(ooxml, embedded labels, table is Sheet1);

Rename Fields using DemoMapping;

but it's not working.

I have the listbox with PharmacyName on each sheet of my QlikView Model,

on the first sheet, it changes PharmacyName to PharmacyDemo, but says the field is unavailable.

On all the other sheets PharmacyName has not change to PharmacyDemo

Gysbert_Wassenaar

Try this:

DemoData:

LOAD *

FROM

(ooxml, embedded labels, table is Sheet1);

DemoMapping:

Mapping LOAD * inline [

OldName, NewName

PharmacyName, PharmacyDemo

PharmacyA, Pharmacy1

PharmacyB, Pharmacy2

PharmacyC, Pharmacy3

];

Rename Fields using DemoMapping;

In this case I used and inline table, but if you have a lot of fields it's easier to maintain it in a seperate text or excel file as in Henric's blog post.


talk is cheap, supply exceeds demand
jagan
Luminary Alumni
Luminary Alumni

Hi,

If you are renaming only one field then instead of Mapping load you can straight away rename it by using

Rename field OldFieldName to NewFieldName;

Regards,

Jagan.

leonchoo
Contributor
Contributor

Hi there,

 

I find your method really useful! however, what if the field value that I am changing has a comma in it?

 

e.g. Fieldvalue 1 is Marketing, Branding and Analytics which I want to change to Fieldvalue 2 which is Marketing, Analytics?

 

Looking forward to your reply and thanks!

leonchoo
Contributor
Contributor

Hi there,

 

I find your method really useful! however, what if the field value that I am changing has a comma in it?

 

e.g. Fieldvalue 1 is Marketing, Branding and Analytics which I want to change to Fieldvalue 2 which is Marketing, Analytics

 

Looking forward to your reply and thanks!