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.
Not applicable

ApplyMap Mith Multipe fields syntax

Attempting to use ApplyMap to join multiple fields from two tables and keep getting MAPPING requires 2-column input. What is the propoer syntax. Works fin when I try to map a single field.
Example:

PercentMap:
Mapping LOAD
State,
Year2005GSP,
Year2006GSP,
Year2007GSP,
Year2008GSP,
Year2009GSP,
Year2010GSP
Resident StateGDP_2005_2011
;
Table2:
LOAD
State,
[2005],
[2006],
[2007],
[2008],
[2009],
[2010],
[2005]/ApplyMap('PercentMap',State,0) as PercentOf2005GSP,
[2006]/ApplyMap('PercentMap',State,0) as PercentOf2006GSP,
[2007]/ApplyMap('PercentMap',State,0) as PercentOf2007GSP,
[2008]/ApplyMap('PercentMap',State,0) as PercentOf2008GSP,
[2009]/ApplyMap('PercentMap',State,0) as PercentOf2009GSP,
[2010]/ApplyMap('PercentMap',State,0) as PercentOf2010GSP,
Resident StateInvestment_2005_20011
;
1 Solution

Accepted Solutions
Luminary
Luminary

Re: ApplyMap Mith Multipe fields syntax

The proper syntax would be

PercentMap_2005:

Mapping LOAD

State,

Year2005GSP

Resident StateGDP_2005_2011

;

PercentMap_2006:

Mapping LOAD

State,

Year2006GSP

Resident StateGDP_2005_2011

;

Table2:

LOAD

State,

[2005],

[2006],

[2007],

[2008],

[2009],

[2010],

[2005]/ApplyMap('PercentMap_2005',State,0) as PercentOf2005GSP,

[2006]/ApplyMap('PercentMap_2006',State,0) as PercentOf2006GSP

Resident StateInvestment_2005_20011

;


Although, I think the data model would be better and you wouldn't have to maintain the script so much if you created one column with the value of year.

StateYear
CA2005
CA2006
NY2005

Karl

2 Replies
Luminary
Luminary

Re: ApplyMap Mith Multipe fields syntax

The proper syntax would be

PercentMap_2005:

Mapping LOAD

State,

Year2005GSP

Resident StateGDP_2005_2011

;

PercentMap_2006:

Mapping LOAD

State,

Year2006GSP

Resident StateGDP_2005_2011

;

Table2:

LOAD

State,

[2005],

[2006],

[2007],

[2008],

[2009],

[2010],

[2005]/ApplyMap('PercentMap_2005',State,0) as PercentOf2005GSP,

[2006]/ApplyMap('PercentMap_2006',State,0) as PercentOf2006GSP

Resident StateInvestment_2005_20011

;


Although, I think the data model would be better and you wouldn't have to maintain the script so much if you created one column with the value of year.

StateYear
CA2005
CA2006
NY2005

Karl

Not applicable

Re: ApplyMap Mith Multipe fields syntax

Thanks that worked.

Community Browser