Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rename the data values of a field

Hi everyone,

Is it possible to rename the data values that is being pulled from database?

For instance,

NatureOfWork:

LOAD

    NatureOfWorkID,

    NatureOfWork

FROM [lib://Master/NatureOfWork.qvd]

(qvd);

The NatureOfWork field contains values as 'Cots', 'Application Development', 'Analytics'

Now I want to change 'Application Development' to 'AppDev'.

Thanks

1 Solution

Accepted Solutions
micheledenardi
Specialist II
Specialist II

Use this;

NatureOfWork:

LOAD

    NatureOfWorkID,

    if(NatureOfWork='Application Development','AppDev',NatureOfWork) as NatureOfWork

FROM [lib://Master/NatureOfWork.qvd]

(qvd);

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

10 Replies
micheledenardi
Specialist II
Specialist II

Use this;

NatureOfWork:

LOAD

    NatureOfWorkID,

    if(NatureOfWork='Application Development','AppDev',NatureOfWork) as NatureOfWork

FROM [lib://Master/NatureOfWork.qvd]

(qvd);

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

Suppose I want to use both the names, then is resident load a good idea?

Example:

In a single sheet,

In 1st table : I should display Application Development

In 2nd : I need to display it as AppDev

However, linkage with other fields should remain the same. Only the display name should be changed.

devarasu07
Master II
Master II

Hi,

In that case just keep the original field and calculated field as new field so that you can use it both table by calling seprate column. Tks

NatureOfWork:

LOAD

    NatureOfWorkID,

NatureOfWork,

    if(NatureOfWork='Application Development','AppDev',NatureOfWork) as NatureOfWork_Short

FROM [lib://Master/NatureOfWork.qvd]

(qvd);

Tks,Deva

Anonymous
Not applicable
Author

Added to this I want to change 2 names,

Application Development' to 'AppDev' and 'Cots' to 'Off-shelf'

both of these should be present in the same table (that is newly renamed table)

P.S Sorry forgot to mention the above previously

devarasu07
Master II
Master II

Hi,

Like this,


NatureOfWork:

LOAD

    NatureOfWorkID,

NatureOfWork,

pick(match(NatureOfWork, 'Application Development', 'Cots'), 'AppDev','Off-shelf') as NatureOfWork_Short

FROM [lib://Master/NatureOfWork.qvd]

(qvd);

Anonymous
Not applicable
Author

Many thanks.. It worked perfectly!

devarasu07
Master II
Master II

Hi,

Just added else condition for revised short name field. so that new calculated field should return complete data set as result. tks

Data:

LOAD * INLINE [

    NatureOfWork

    Application Development

    Infra Side

    Marketing

    Finace

    Analyst

    Developer

    Admin,

    Cots

];

Fact:

Load*,

if(WildMatch( NatureOfWork, 'Application Development'),'AppDev',

    if(NatureOfWork='Cots','Off-shelf',NatureOfWork)) as NatureOfWork_Short

          Resident Data;

     Drop table Data;

Capture.JPG

devarasu07
Master II
Master II

Hi,

below Expression  is much better than several layers of nested If()s.

just Using WildMatch() function able added default value as well:

Data:

Load *,

Pick( WildMatch(NatureOfWork, 'Application Development', 'Cots','*'), 'AppDev', 'Off-shelf', NatureOfWork) as NatureOfWork_Short;

LOAD * INLINE [

    NatureOfWork

    Application Development

    Infra Side

    Marketing

    Finace

    Analyst

    Developer

    Admin,

    Cots

];

Hope this helps

Regards,

Deva

Erlik
Contributor II
Contributor II

It works. Thank you.