Automate DME Call

 6 Replies
 1 Subscribed to this topic
 27 Subscribed to this forum
Sort:
Author
Messages
SCMaster-jk2
Veteran Member
Posts: 100
Veteran Member

    Hi everyone,

    Not sure if this is the correct forum to post in but I'm trying to automate a query using Powershell. I'm having an issue with creating the url for the query though.

    URL below:

    https://__lawson-server__...soUpdateSession=TRUE&_ssoOrigUrl=/servlet/Router/Data/Erp?KEYUSAGE=PARAM%26MAX=1000%26NOHEADER=TRUE%26OUT=CSV%26DELIM=%09%26NEXT=TRUE%26PROD=PROD%26FIELD=COMPANY%3BLOCATION%3BLOCATION.NAME%3BBINGRPDTL.BIN-SEQ%3BPREFER-BIN%3BITEM%3BREORDER-POINT%3BUOM%3BGL-CATEGORY%3BCHARGEABLE-FL%3BITEMMAST.MANUF-NBR%3BITEMMAST.DESCRIPTION%3BITEMMAST.DESCRIPTION3%3BITEMMAST.INVEN-MAJCL%3BTRACKING-FL%3BITEMSRC.VENDOR%3BITEMSRC.PURCH-FR-LOC%3BITEMMAST.USER-FIELD3%3BACTIVE-STATUS%3BITEMMAST.ICSEGMENT%3BITEMMAST.ICFAMILY%3BITEMMAST.ICCLASS%3BITEMMAST.ICCOMMODITY%26SELECT=LOCATION%3D749WH%26FILE=ITEMLOC%26SK1=749%26SK2=749WH%26SK3=210792%26


    I'm navigating to the URL but then I get an error saying: "Error: no protocol: /servlet/Router/Data/Erp?...[rest of url]" 

    If I login using the sso URL and then using the DME url, the file pulls just fine, only when I combine them do I get this error. I'm following the examples at this site: https://itlearnings.wordpress.com/tag/sso/


    Does anyone have any experience running scripts to automate queries? Unfortunately, I don't have access to use python/perl or other scripting languages so I'm limited to Powershell.

    Woozy
    Veteran Member
    Posts: 709
    Veteran Member
      Hi SCMaster-jk2,

      I haven't tried to do this...but right off the bat it seems to me that the ssoOrigUrl needs to be a complete url including the host (though you may need to escape the special chars as well):

      https://__lawson-server__...USAGE=PARAM%26MAX...

      I hope this helps...
      Kelly
      Kelly Meade
      J. R. Simplot Company
      Boise, ID
      SCMaster-jk2
      Veteran Member
      Posts: 100
      Veteran Member
        We're getting somewhere!

        I added the full server name as Woozy mentioned and now I no longer get the error. However, it only downloads some of the file. At the bottom it gives me 3 URLs:
        NEXT
        PREV
        RELOAD

        If I use the same code but replace the ssoOrigUrl with the "NEXT" url, it gives me more data from my query. I'm going to work on creating a loop to continue pulling more data and replacing my URL with the "NEXT" url.

        One concern I have is the file that's downloaded is not CSV format. It's more of like a text dump and I can't separate out the values in Excel properly. Any ideas? Is there a way to look at the source code for the Query Wizard?
        Woozy
        Veteran Member
        Posts: 709
        Veteran Member
          I think you can add "&OUT=CSV" to cause it to display as a CSV file. You can change the delimiter to a tilde by adding "&DELIM=~" (or use whatever delimiter char you prefer).
          Kelly Meade
          J. R. Simplot Company
          Boise, ID
          Woozy
          Veteran Member
          Posts: 709
          Veteran Member
            You should check out Infor document "Doc for Developers: IOS Application Program Interfaces" in the doc repository. It provides all the details about how these calls are built and the various options available.

            In InforXtreme, I found this in Search>>Browse Documentation>>Lawson>>Technology>>System Foundation>>Lawson System Foundation>>{LSF version} and filter by "IOS" (contains).
            Kelly Meade
            J. R. Simplot Company
            Boise, ID
            SCMaster-jk2
            Veteran Member
            Posts: 100
            Veteran Member
              Thanks, Kelly, I'll check the docs.

              Will the docs explain where to add the "&OUT=CSV" as well as the delim?
              Woozy
              Veteran Member
              Posts: 709
              Veteran Member
                You can put them right at that end of your query string, one after another. Be sure to include the ampersand before each of them: "{yourquerystring}&OUT=CSV&DELIM=~".
                Kelly Meade
                J. R. Simplot Company
                Boise, ID