Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Renaming Records in a Field


Hi All,

I have an Excel file with a Column called Measures. This contains the following values:

Units

Actuals

Sell In

Channel Fill

When I create a listbox, these are the selection values that appear.

I need to change the name of some of these values in the listbox. eg.. change Units to 'Demand Units'

Any ideas on how I can do this? Can I rename the values during the script load?

Regards

John

9 Replies
sundarakumar
Specialist II
Specialist II

while loading in load script

if(Measures='Units','Demand Units',Measeures) as Measures,

....

from xyz;

_sundar

Luis_Cortizo
Former Employee
Former Employee

Hi, John

    I presume that in you're script you have something similar to:

Load

    [...]

    Measures,

    [...]

FROM [Your_Excel_File];

The more straightforward way of accomplishing what you want would be a simple If statement. Something like:

Load

    [...]

    If(Measures='Units', 'Demand Units', Measures) as Measures;

    [...]

FROM [Your_Excel_File];

Please find an example with an inline table attached.

Best regards.

Not applicable
Author

Hi Sundar,

You can create a inline table in script rather than using if condition.Performancewise it would be ggod.

Luis_Cortizo
Former Employee
Former Employee

If that's an option I totally agree with Mahendra

maxgro
MVP
MVP

try with

load

pick(wildmatch(Measures, 'Units',  'Sell In', '*'), 'Demand Units',  'New Sell In', Measures) as Measures;

LOAD * INLINE [

Measures

Units

Actuals

Sell In

Channel Fill

];

Clever_Anjos
Employee
Employee

map:

mapping load * INLINE [

From, To

Units,Demand Units

Actuals,Demand Actuals

Sell In,Sell In

Channel Fill,Channel Fill,

];

LOAD

*,

applymap('map',Measures) as Measures2

from yourqvd(qvd);

Not applicable
Author

HI All,

Thanks for all the replies..

I need to change more that one value, how do I amend the following code to do this? I tried afew possibilities but couldn't get it to work - I got a duplicate error.

If(Measures='Units', 'Demand Units', Measures) as Measures;

Thanks so much

John

maxgro
MVP
MVP

perhaps I don't understand your question but you can use my answer or Clever Anjos answer to change more than one value

if you like if you can use nested if

If(Measures='Units', 'Demand Units',

If(Measures='Old', 'New',

If(Measures='Old1', 'New1',

Measures))) as Measures,


or I'm missing something?



sundarakumar
Specialist II
Specialist II

I think u have write script as below

load

if(measure='units','demand units',measure) as measures,

if(meseure='name','newname',measure) as measure,

...

form

xyz;

This will result in duplicate error, u should create nested if like

load

if(measure='units','demannd units',if(measure='name','newname',if(measures='name2','newname2',measure))),

...

from xyz;

bold is the innermost if statement

underlined is the last but one

This is how nested if should be written.

hope this helps.

-Sundar