DME query with field that may contain &

 6 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
mikeD
Basic Member
Posts: 5
Basic Member
    When I run DME query to pull in the invoice discount amount if the invoice number contains a "&" then the DME fails.  Is there a trick to avoid this problem?
    Ragu Raghavan
    Veteran Member
    Posts: 476
    Veteran Member
      Try 'escape' :

      var s = portalWnd.DMEPath;
      s += "?PROD=" + sPDL;
      s += "&FILE=PATHFIND";
      s += "&FIELD=EMPLOYEE;LAST-NAME;FIRST-NAME;MIDDLE-INIT
      s += "&INDEX=PTFSET5";
      s += "&KEY=" + vCompany + "=18=" + escape(vCode);
      s += "&MAX=9999";
      s += "&OUT=XML";
      mikeD
      Basic Member
      Posts: 5
      Basic Member
        I am trying to retrieve 1 record. Here is part of my DME...
        INDEX=APISET1&KEY=5=209186=WE 0092411&0100111=0=0&XCOLS=TRUE

        The key to API is company (5), vendor (209186), invoice ( WE 0092411&0100111), suffix(0), and cancelSeq(0)
        The & within one of the key values is causing it to fail.
        I am not sure where I would put the escape(vCode)
        Ragu Raghavan
        Veteran Member
        Posts: 476
        Veteran Member
          are you hardcoding the invoice# ? if so, try

          INDEX=APISET1&KEY=5=209186=escape("WE 0092411&0100111")=0=0&XCOLS=TRUE

          if you are buliding the DME call with variables, then escape the variable that holds the invoice#: escape(vInvoice)

          John Henley
          Posts: 3353
            Or use escaped value for ampersand, i.e., & or %#37;
            Thanks for using the LawsonGuru.com forums!
            John
            inst1234
            New Member
            Posts: 1
            New Member
              Regarding the DME coding with key values, the vendor must be code with preceding spaces because it's 9 AlphaRight.
              mikeD
              Basic Member
              Posts: 5
              Basic Member
                The escape function on the invoice variable did the trick
                Thanks