Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

hkg_qlik
Contributor 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
MVP
MVP

Re: Scripting

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;

2 Replies
MVP
MVP

Re: Scripting

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;

MVP & Luminary
MVP & Luminary

Re: Scripting

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