5 Replies Latest reply: Aug 2, 2016 9:46 AM by Sunny Talwar RSS

    Qlik Sense 3.0 - Dynamic ApplyMap No Longer Working

    Justin McPheeters

      Hi everyone,

       

      I am weighting scores for each phase of an account that we manage.  The weight of each phase depends on the current phase that the account is in (see attachment file "Phases").  There are 4 phases and an account can only be in one phase at a given time, but will have a score for each of the previous phases it's gone through.

       

      So, in my code I create a mapping for each of the weight breakdowns and then use the ApplyMap function to choose the corresponding table and value to bring back.  Then, I multiply the weight by the original score of the phase, thus giving me a weighted score.  I was dynamically setting the table (map_id Expression) in the ApplyMap function prior to the Qlik Sense 3.0 upgrade, but now I receive an "Unknown Error".  I've attached a simplified version of my code to show what I was doing previously.

       

      I understand that there are several other ways to get to the desired result; I've implemented one of them already.  However, I am wondering if anyone else is experiencing the inability to dynamically set the "map_id Expression" value in the ApplyMap function since their upgrade to Qlik Sense 3.0 or 3.0.1.  I'd like to report this as a potential bug if so.

       

      Thanks,

       

      Justin

        • Re: Qlik Sense 3.0 - Dynamic ApplyMap No Longer Working
          Sunny Talwar

          Did you happen to miss the variable within the ApplyMap?

           

          // **** Number of phase weights ****

          Let vTemp = Trim(Replace(FieldName(NoOfFields('Phases'), 'Phases'), 'Weight ', ''));

           

          // **** Loop through and create weight mappings ****

          For i = 1 to $(vTemp)

            Weight$(i):

            Mapping Load

            [Phase],

            [Weight $(i)]

            Resident [Phases];

          Next;

           

          // **** Get Weighted Phase Score ****

          Load [Account Name],

            [Phase],

            Max([Phase Score]) * ApplyMap('Weight$(i)' & Max([Current Phase]), Max([Phase]), Null()) as [Weighted Phase Score],

          Resident [Tasks]

          Group by [Account Name], [Phase];

            • Re: Qlik Sense 3.0 - Dynamic ApplyMap No Longer Working
              Justin McPheeters

              Hi Sunny,

               

              Thanks for the input.  I'm using the "Max([Current Phase])" piece as the variable as it is different for each account.

               

              // **** Number of phase weights ****

              Let vTemp = Trim(Replace(FieldName(NoOfFields('Phases'), 'Phases'), 'Weight ', ''));

               

              // **** Loop through and create weight mappings ****

              For i = 1 to $(vTemp)

                Weight$(i):

                Mapping Load

                [Phase],

                [Weight $(i)]

                Resident [Phases];

              Next;

               

              // **** Get Weighted Phase Score ****

              Load [Account Name],

                [Phase],

                Max([Phase Score]) * ApplyMap('Weight' & Max([Current Phase]), Max([Phase]), Null()) as [Weighted Phase Score],

              Resident [Tasks]

              Group by [Account Name], [Phase];

                • Re: Qlik Sense 3.0 - Dynamic ApplyMap No Longer Working
                  Sunny Talwar

                  May be try this, not sure if this will work or not because I have not tested this, but give it a shot

                   

                  // **** Get Weighted Phase Score ****

                  LOAD [Account Name],

                    Phase,

                    MaxPhaseScore * ApplyMap('Weight' & MaxCurrentPhase, MaxPhase, Null()) as [Weighted Phase Score];

                  LOAD [Account Name],

                    [Phase],

                    Max([Phase Score]) as MaxPhaseScore

                    Max([Current Phase]) as MaxCurrentPhase

                    Max(Phase) as MaxPhase

                  Resident [Tasks]

                  Group by [Account Name], [Phase];

                    • Re: Qlik Sense 3.0 - Dynamic ApplyMap No Longer Working
                      Justin McPheeters

                      Hi Sunny,

                       

                      I gave that a shot (as it wasn't what I implemented as a fix for the issue) but when I try to load the data Qlik freezes at that piece of code and never completes.  I have to close out of the app, wait a few minutes, and then come back into the app.  If I try to get back into the app right away it shows the circles/bubbles of the load screen for the app and it doesn't ever load the app...

                       

                      I'm not sure what the issue is with the code that you provided, as it doesn't provide an error.  But again, I'm just trying to get some awareness around my original issue.  I've already implemented a fix; I just want to get a consensus that it is indeed an issue with Qlik Sense 3.0 and above.

                       

                      Thanks again,

                       

                      Justin