Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

aaronnayan
Contributor III

Rename 2 values in field to something else

Hi Guys,

Can anyone aid me in renaming 2 values within a field within the script?

Field = [Salesperson]

  • John
  • Mary
  • Sue
  • Frank
  • Barbara
  • Terry

I would like to change "Sue" to "Susan" and "John" to "Jonathon".

I have already tried if(Salesperson='Sue','Susan', AND if(Salesperson='John','Johnathon', Salesperson) as Salesperson

It doesnt work. The field Salesperson comes from a QVD with more than a 100 values.

I do alternatively have the SalespersonID field if something could be done from that?

 

 

 

 

5 Replies
Partner
Partner

Re: Rename 2 values in field to something else

Try using ApplyMap() 

 

MapPerson:

MAPPING Load * inline [

A , B

Sue, Susan

John, Johnaton

];

 

Data:

Load 

Applymap ('MapPerson', Salesperson, Salesperson) as Salesperson,

Other fields

From Source;

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
aaronnayan
Contributor III

Re: Rename 2 values in field to something else

Hi That doesnt work. I get no values loaded in the field....

Partner
Partner

Re: Rename 2 values in field to something else

Oops, my bad. It is supposed  to be mapping load. I'll adjust my original answer. 

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Support
Support

Re: Rename 2 values in field to something else

Aaron, did Vegar's adjust post get things working as you wished?  If so, be sure to come back to the thread and use the Accept as Solution button on his main post to give him credit for the help and to let others know it did work.  If you are still working upon things, leave an update.

Regards,
Brett

To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
Marcos_rv
Contributor II

Re: Rename 2 values in field to something else

try this:
if(Salesperson='Sue', 'Susan' , if(Salesperson='John' , 'Johnathon', Salesperson) ) as Salesperson