2 Replies Latest reply: Sep 12, 2018 1:07 PM by Tomasz Lewandowski RSS

    map using dual

    George Menoutis

      If I use this in Qliksense:

       

      YesNoMap:
      MAPPING LOAD num, dual(str, num) INLINE [
      num, str
      0, No
      1, Yes
      ];

      MAP Shipped USING YesNoMap;


      Then Shipped (after a load) does NOT work as dual, as intended. Is the functionality not yet implemented?

        • Re: map using dual
          Marcus Sommer

          It should work. Maybe there is a mistake with the fieldnames or your order of the actions is wrong. If I do the following in QlikView it worked (switching to autogenerate just to avoid potential problems with the number-interpretation of inline loads):

           

          YesNoMapTemp:

          load 0 as num, 'no' as str autogenerate 1;

          load 1 as num, 'yes' as str autogenerate 1;

           

          YesNoMap:

          mapping load num, dual(str, num) resident YesNoMapTemp;

           

          drop tables YesNoMapTemp;

           

          MAP F1 USING YesNoMap;

           

          t:

          load 0 as F1, 'a' as F2 autogenerate 1;

          load 1 as F1, 'b' as F2 autogenerate 1;

           

           

          - Marcus

          • Re: map using dual
            Tomasz Lewandowski

            Hi George,

             

            It works, but it seems that you cannot directly use a field value - instead you should use a wrapping function returning values 0 and 1.

             

             

            For example, during your load you should use


            If(Shipped, 1, 0) as Shipped

                 instead of

            Shipped

             

            --

            Tomasz