2 Replies Latest reply: Feb 9, 2012 1:52 PM by Kevin Gould RSS

    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
      ;
        • Re: ApplyMap Mith Multipe fields syntax
          Karl Pover

          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