Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

gino2780
Contributor

recode field into new field

Hello,

how can i recode a categorical textfield into a new dummy textfield?

i know how to do it with the INLINE command:

Table:

LOAD *,

  Pick(Match(Status, 'DELETED', 'ERROR' ,Status), 'nein', 'nein', 'ja') as Status1;

LOAD * Inline [

Status

DELETED
ERROR
GENERATED
MOVED
PUBL_d3
PUBL_PORTAL
PUBLISH_ERROR
NEW
];

Is there a way to work with if-Statements in the load script?

 

StatusStatus1
DELETEDno
ERRORno
GENERATEDyes
MOVEDyes
PUBL_d3yes
PUBL_PORTALyes
PUBLISH_ERRORyes
NEWyes
Tags (1)
1 Solution

Accepted Solutions
ramasaisaksoft
Valued Contributor III

Re: recode field into new field

if(Stats='DELETED' or Status='ERROR',NO,YES) as Status1

correct me if understand your query wrongly.

4 Replies
ramasaisaksoft
Valued Contributor III

Re: recode field into new field

if(Stats='DELETED' or Status='ERROR',NO,YES) as Status1

correct me if understand your query wrongly.

gino2780
Contributor

Re: recode field into new field

Thank you so far. But it doesn't seem to work as intended.

"No" works and picks the right values. "Yes" doesn't work:

MVP
MVP

Re: recode field into new field

Is it possible that 'NEW' and 'PUBLISH_ERROR' do not (or did not) exist in the table being loaded with the attribute expression?

They could exist in another table, or they could have been added later. These tow value seem not to have a null/missing value for Status1.

gino2780
Contributor

Re: recode field into new field

Jonathan, you are absolutely right. I've checked the real value Distribution and both are not present anymore, but have been Status-values once. Good Job.