4 Replies Latest reply: Oct 21, 2016 12:37 PM by Peter Cammaert RSS

    mapping load

    Praveena Velagapudi

      I have below mapping load table

       

      ID ,Text

      002 ,text1

      2 ,text2

       

      when applymap is applied, it default takes to 2 for even 002. How can I fix it to exact?

        • Re: mapping load
          Sunny Talwar

          May be load ID field in the mapping table using Text() function:

           

          MappingTable:

          Mapping

          LOAD Text(ID) as ID,

                    Text

          FROM....

          • Re: mapping load
            Peter Cammaert

            The reason is that a Mapping Table acts like a symbol table with dual values. Identical numerical values cannot have different text values, just like dual values.

              • Re: mapping load
                Sunny Talwar

                peter -

                 

                So it won't work even if force Text() function to it? Have not tested what I proposed, but I wonder if you already have tested this or know this for fact.

                 

                Best,

                Sunny

                  • Re: mapping load
                    Peter Cammaert

                    Yes, it works if you observe the rule that only text values are stored, and that QlikView should be blocked from interpreting and passing dual values with a numerical component to search for.

                     

                    Anyway it shoyuld be easy to figure out what works and what doesn't. I used this code (copied from your post)

                     

                    MT:
                    Mapping
                    LOAD Text(ID) as ID, Text INLINE [
                    ID, Text
                    2, Text1
                    02, Text2
                    002, Text3
                    0002, Text4
                    ];
                    
                    
                    LET vTest1 = applymap('MT', 2, 'NotFound');
                    LET vTest2 = applymap('MT', '02', 'NotFound');
                    LET vTest3 = applymap('MT', text('002'), 'NotFound');
                    
                    
                    

                     

                    to get this result

                    Mapping Load thread237296 .jpg

                    Peter

                     

                    [Edit] Attached the example document to further play with.