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

Convert the Numbers into Names in a field.

I have column like these

Gender

1

0

1

1

0;

I want output 1 with Male, 0 with Female.

Gender

Male

Female

Male

Male

Female;

2 Replies
tresesco
MVP
MVP

Use expression in the list box like:

=If(Gender=1, 'Male', 'Female')


For script:

Load

        If(Gender=1, 'Male', 'Female') as Gender

from <> 

JaMajka1
Partner Ambassador
Partner Ambassador

Hello,

if you want to replace IDs by descriptions in load script it is good to use applymap() function. Yo can define the map in the beginning of your script and then use it whetever you want.

In this case the map will be:

[M_gender]:

mapping load * inline [

gender_ID,gender_text

0,Female

1,Male

];

And the function during the resident load will be like:

applymap('M_gender',gender) as gender_text

You can find more about applymap here Data Cleansing or on qlik help https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Scripting/MappingFunctions/ApplyMa....

Hope it will help ,

Maria