Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
hagar333
Contributor

Populating data in a blank field Null Mapping ?

Hi Guys,

I have been testing different ways to solve this problem with eratic results

I need to map the blank PG field with PX. I tried a wildcard *REV* and no go

I now have a test model setup with mapping but there might be a better way of doing this

see my Test Qvw attched.

data:

load * inline [
ITEM, PG, Value
123123,AS, 2300,
620023,BC, 5000,
1-REV-I,  ,9000,
2-REV-I,  ,9001
3-REV-I,  ,9002
4-REV-I,  ,8200,
5-REV-I,  ,7000,
6-REV-I,  ,760,
7-REV-I,  ,8800,
8-REV-I,  ,800,
9-REV-I,  ,3210,
]
;

MAP_NewCode:
mapping load * inline [
ITEM, PG,
1-REV-I,PX
2-REV-I,PX
3-REV-I,PX
4-REV-I,PX
5-REV-I,PX
6-REV-I,PX
7-REV-I,PX
8-REV-I,PX
9-REV-I,PX
]
;

data2:
load
ITEM,
if (PG=' ', ApplyMap('MAP_NewCode', ITEM, PG)) as PGs,
Value
Resident data;
drop Table data;

any help would be appreciated

Peter

Tags (3)
1 Solution

Accepted Solutions

Re: Populating data in a blank field Null Mapping ?

Oh well, then we do it like this: if (len(PG)=0, ApplyMap('MAP_NewCode', ITEM, PG),PG) as PGs,

Inline doesn't seem to create real nulls, but empty strings.


talk is cheap, supply exceeds demand
4 Replies

Re: Populating data in a blank field Null Mapping ?

try: if (isnull(PG), ApplyMap('MAP_NewCode', ITEM, PG)) as PGs


talk is cheap, supply exceeds demand
hagar333
Contributor

Re: Populating data in a blank field Null Mapping ?

Hy again Gysbert

I tried that one before as well but no go !

Peter

Re: Populating data in a blank field Null Mapping ?

Oh well, then we do it like this: if (len(PG)=0, ApplyMap('MAP_NewCode', ITEM, PG),PG) as PGs,

Inline doesn't seem to create real nulls, but empty strings.


talk is cheap, supply exceeds demand
hagar333
Contributor

Re: Populating data in a blank field Null Mapping ?

Yes that worked!  Thanks, but now you have an intersting point, in the actual qvw I need to apply this

I have real Nulls so I should use your orignal code

if (isnull(PG), ApplyMap('MAP_NewCode', ITEM, PG)) as PGs

?

Community Browser