Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
aishwarya17
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
Not applicable

Re: Rename the data values

Use this;

NatureOfWork:

LOAD

    NatureOfWorkID,

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

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

(qvd);

8 Replies
micheledenardi
Not applicable

Re: Rename the data values

Use this;

NatureOfWork:

LOAD

    NatureOfWorkID,

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

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

(qvd);

aishwarya17
Not applicable

Re: Rename the data values of a field

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
Not applicable

Re: Rename the data values of a field

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

aishwarya17
Not applicable

Re: Rename the data values of a field

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
Not applicable

Re: Rename the data values of a field

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);

aishwarya17
Not applicable

Re: Rename the data values of a field

Many thanks.. It worked perfectly!

devarasu07
Not applicable

Re: Rename the data values of a field

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
Not applicable

Re: Rename the data values of a field

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