Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

change values of a loaded field

I have a loaded gender field which contains the values M and F but I want to display those as Male and Female . Anyone has a suggestion about how to do this?

1 Solution

Accepted Solutions
Not applicable
Author

William,

yes you can ...

Gender:
LOAD
GENDER,

If(GENDER= 'F', 'Female', If(GENDER= 'M', 'Male','NN')) as NewGenderField,
GENDER_KEY
FROM
[..\QVD\GENDER.QVD] (qvd);

A good idea is to place this statement into the load script which produced the qvd file.

Rainer

View solution in original post

6 Replies
Not applicable
Author

Hi,

in your expression field, do the following =if(Gender = 'M', 'Male', if(Gender = 'F', 'Female', 'Unknown'))

Hope this help..

Regards,

Say Chao

Not applicable
Author

Thanks, can I do this somehow in my loadscript?

Gender:
LOAD
GENDER,
GENDER_KEY
FROM
[..\QVD\GENDER.QVD] (qvd);

Not applicable
Author

Hi William,

add the following line into your script:

If(YourFieldName = 'F', 'Female', If(YourFieldName = 'M', 'Male','NN')) as NewGenderField

So you will also find records where the values are not set.

Rainer

Not applicable
Author

//Here is an example, you can paste it into a new QVW doc:

GenderTemp:
LOAD * INLINE [
gender
M
F
F
M
F
M
];

Gender:
Load If(gender='M','Male','Female') as Gender //conditional changing the field content
Resident GenderTemp;

Drop Table GenderTemp;

//Regards, C

Not applicable
Author

William,

yes you can ...

Gender:
LOAD
GENDER,

If(GENDER= 'F', 'Female', If(GENDER= 'M', 'Male','NN')) as NewGenderField,
GENDER_KEY
FROM
[..\QVD\GENDER.QVD] (qvd);

A good idea is to place this statement into the load script which produced the qvd file.

Rainer

Not applicable
Author

You guys are quick! Thanks for all the replies! I have used the solution of Rainer in the LOAD script which produces the qvd file and it works great!