Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

mttconseil
New Contributor

Applymap Question

Hello,

I am driving nuts...

Any clue why I do not get any result from the ApplyMap? the result is not found and it does not even display 'missing'...

Applymap('Map_DiscountedSeason',Floor(MonthStart(DateId),1),'missing') as DiscountedCollection

(with DateId='01/01/2018')

Also, I would like to stress that Floor(MonthStart('01/01/2018'),1)=43101 which is also the value I see when I check the Map using the view panel.

Thank you in advance,

MT

File :

TimeFrame;DiscountedSeason

2018-1;0

2018-1;0

Map_DiscountedSeason:

LOAD Num(Date#(TimeFrame, 'YYYY-MM')) As Month,

    [DiscountedSeason]

FROM [$(folderData)/SeasonToBeDiscounted.csv]

(txt, codepage is 1252, embedded labels, delimiter is ';', msq);

3 Replies
mdmukramali
Valued Contributor II

Re: Applymap Question

Hi,

In the applymap table before load statement you have to use Mapping Syntax.

And thus table should be load before to the main Table.

Map_DiscountedSeason:

Mapping

LOAD Num(Date#(TimeFrame, 'YYYY-MM')) As Month,

    [DiscountedSeason]

FROM [$(folderData)/SeasonToBeDiscounted.csv]

(txt, codepage is 1252, embedded labels, delimiter is ';', msq);

Re: Applymap Question

My guess is that Map_DiscountedSeason is not a valid mapping table and therefore you are getting nulls. A couple of notes regarding mapping tables.


1. The mapping table must be loaded in the script before it is referenced in an ApplyMap().

2. You must use the MAPPING prefix on the load as Mohammed Mukram indicated. If you can see the map in the table viewer you forgot the MAPPING prefix.

3. In QV11, a missing mapping table causes null to be returned from ApplyMap().  In QV12.10, a missing map throws a script error.


-Rob

http://masterssummit.com

http://qlikviewcookbook.com

mttconseil
New Contributor

Re: Applymap Question

Thank you Mohammed and Rob !

It is working fine now and I have learnt usefull tips!

Best regards,

MT