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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
hkg_qlik
Creator III
Creator III

Scripting

Hi,

I loading a shipping table. There are few fields in shipping table that stores information as '0' and '1'. I would like to rename '0' as 'No' and '1' as 'Yes'.

i.e. Field Name - Shipped: Rename '0' as 'Not Shipped' and '1' as 'Shipped'

Regards,

H

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

LOAD

if(Shipped,'Shipped','Not Shipped') as Shipped,

...

FROM YourTable;

or using a mapping table:

MAP:

MAPPING LOAD * INLINE [

F1, F2

0,Not Shipped

1,Shipped

];

LOAD

applymap('MAP',Shipped,'unknown status') as Shipped,

...

FROM YourTable;

View solution in original post

2 Replies
swuehl
MVP
MVP

Try

LOAD

if(Shipped,'Shipped','Not Shipped') as Shipped,

...

FROM YourTable;

or using a mapping table:

MAP:

MAPPING LOAD * INLINE [

F1, F2

0,Not Shipped

1,Shipped

];

LOAD

applymap('MAP',Shipped,'unknown status') as Shipped,

...

FROM YourTable;

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Perhaps more than the OP asked for, but I like to load or map as a dual. That way you get "Yes" / "No" in display fields (like listboxes and table columns) but still retain the the ability to use expressions like

=sum(Shipped)

-if(Shipped,...

Create the mapping table like this:

YesNoMap:

MAPPING

LOAD from, dual(to,from) INLINE [

from, to

0, No

1, Yes

];

Map Shipped USING YesNoMap;

-Rob

http://robwunderlich.com