8 Replies Latest reply: Aug 26, 2013 2:03 PM by Ralf Becher RSS

    Having Issues with MAP Command

      Is anyone aware of any situation in which the MAP or APPLYMAPPING commands don't work?

       

       

      I have a situation in which a have an inline table that I want to use to add a numeric value to a text value, see below:

       

       

       

      MapTable:

       

      mapping load

      x,y

      inline [

      x,y

      Period payment,15
      Ticket,16
      Purse Payment,14
      Load,1

      Hotlist,10
      Activation,12
      Configuration,11
      Purse List,1
      Period List, 2

      ]
      ;



      MAP [TypeID] USING MapTable;

       

       

      Later in the script I have the following:

       

       

      LOAD



      timestamp#(CREADATE,'DD/MM/YYYY hh:mm:ss') as  DateTime,
      NAME,
      DEVICEID as DeviceID,
      SALESDETAILEVSEQUNO,
      TICKETDESC,
      TICKETDESC as TypeID,

       

       

       

      I have suggessfully used this script once, but now I litterally copy-pasted the script into another file and it doesn't seem to work.  I've even tried using the Applymap function and it never seems to find a match.

       

      The only difference that I can tell between the time ths works successfully and the time is doesn't is the load source.  (The people supplying the data are now supplying it in a new format)

       

      The successful run was coming in .xls format

       

       

      FROM



      $(var_folder)\Report*.xlsx

      (
      ooxml, embedded labels, table is Sheet1);

      Store css into $(var_folder2)\csstransJuly2013.qvd;

       

       

       

       

      The unsuccessful run is coming in XML format

       

      FROM

      [tdr July 10.xml] (XmlSimple, Table is [TDR/LIST_G_MAIN/G_MAIN/LIST_G_SALESDETAIL/G_SALESDETAIL]);

       

       

       

      What I used to get (and still get with the old format) are two fields that look like this

       

       

      TICKDESC               TypeID

       

      Period Payment          15

      Period Payment          15

      Period Payment          15

      Period Payment          15

      Load                              1

      Load                              1

      Period Payment          15

       

       

      etc....

       

      Now it's looking like:

       

       

       

      TICKDESC               TypeID

       

      Period Payment          Period Payment

      Period Payment          Period Payment

      Period Payment          Period Payment

      Period Payment          Period Payment

      Load                             Load

      Load                             Load

      Period Payment          Period Payment

       

       

       

      etc....

       

       

       

      Can anyone offer any suggestion that can help me fix this issue.

       

       

      Thanks,

       

       

      Jeff

        • Re: Having Issues with MAP Command
          Marcus Sommer

          Mapping per MAP-Command will directly executed before the script-load had finished. This meant it is not available before. To Match data to another tables use applymap - see also the last part from Map ... using in the help.

           

          - Marcus

          • Re: Having Issues with MAP Command
            Stefan Wühl

            Any chance that you can upload a small sample file together with a sample XML source file?

            • Re: Having Issues with MAP Command
              Ralf Becher

              Hi Jeff,

               

              I have tried this with a small example xml file and mapping works. The only error I can see now is that the data don't match because you have a wrong value in your mapping table:

               

              Period payment,15


              But the data are with capital Payment! The mapping is case sensitive..

               

              - Ralf

              • Re: Having Issues with MAP Command

                Ralf (et all)

                 

                 

                I'm thinking the issue has to do with data not matching (although I'm not sure how as it's exactly the same file format as before.)  I tried hardcoding a mapping criteria and I got it to work, it only seems to be when I reference the field in the origin table does every fall apart.

                 

                Thanks everyone for all your help.  I still don't have it working, but I no longer think it't the mapping command, I think it's some type of hidden formatting issue.

                 

                 

                Jeff

                • Re: Having Issues with MAP Command

                  Follow-up,

                   

                   

                  I did a test using the same data, just using a couple different fields.  I created another inline table, the first time I reference a numeric field and using the MAP USING command I was able to successfully map the numbers in the field to text.  The second test was using a different text field and trying to map this field with the same MAP USING command and an inline table. This time, just like the data I was trying to use initially, I was not successful.

                   

                  As a result I'm concluding that I'm able to Map from a numeric field, but not able to MAP from a text field.  Is this true, or is this just an issue I'm facing with my data?

                   

                  Is there a way for me to reformat my text fields so that they'll be recognizable by the script as the same text?

                   

                  Or can anyone suggest another reason why the MAP USING command doesn't seem to be matching my text fields.

                   

                  Thanks again for everyones contributions.  It's been very much appreciated.

                   

                   

                  Jeff

                  • Re: Having Issues with MAP Command

                    Thanks everyone,

                     

                     

                    As I was writing my last post I actually came up with the answer that solved my question.  It turned out there were some non-vible characters in the data.  Once I added a TRIM command to my script everything worked fine.

                     

                    I'll put this under the catagory of an ID10T error.  (We'll maybe not quite, but let's face it, for an issue that had me stymied for so long it was a pretty simple answer!!!!!)

                     

                     

                    Jeff