Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
gino2780
Creator
Creator

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
1 Solution

Accepted Solutions
ramasaisaksoft

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

correct me if understand your query wrongly.

View solution in original post

4 Replies
ramasaisaksoft

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

correct me if understand your query wrongly.

gino2780
Creator
Creator
Author

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

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

jonathandienst
Partner - Champion III
Partner - Champion III

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.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
gino2780
Creator
Creator
Author

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.