PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 04/12/2019 11:25 AM by  PD
Selec Top(5000) in DME call
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages
PD
Technical Assoc Manager
Private
Veteran Member
(100 points)
Veteran Member
Posts:52


Send Message:

--
04/12/2019 9:38 AM

    How do I modify the code below to select or return top (5000) records?

    Another option is to return records of three months ago from today's date. How do I modify to achieve it?

     

    var sDME = "?PROD=" + vProdLine;
     sDME += "&FILE=ZAP161DATA";
     sDME += "&FIELD=COMPANY;VENDOR-NUMB;VENDOR-NAME;INVOICE-NUMB;INVOICE-DATE;PAYMENT-DATE;";
     sDME += "PAYMENT-CODE;PAYMENT-NUMB;CASH-CODE;REMIT-TO-CODE;PAYMENT-AMT;DISCOUNT-AMT;NET-PAY-AMT;"
     sDME += "EMAIL-ADDRESS;EMAIL-SNT-DATE;" 
     sDME += "EMAIL-ADDRESS;EMAIL-SNT-DATE;RUN-SEQUENCE;RUN-DATE;RUN-TIME;" 
     sDME += "PROC-STAT-FLAG;" 
     sDME += "&MAX=99";
     
     if (parmtype == "V")
     {
            sDME += "&INDEX=ZAPSET6";
           sDME += "&KEY=" + parmVenNumb + "=" + parmRemit + "==";
      
           if (parmRemit != "")
                 sDME += "&SELECT=PROC-STAT-FLAG^%21%3DNEW%26PROC-STAT-FLAG^%21%3DREST";
           else
                 sDME += "&SELECT=PROC-STAT-FLAG^%21%3DNEW%26PROC-STAT-FLAG^%21%3DREST%26REMIT-TO-CODE^%3C%3D0";
     }
     if (parmtype == "D")
     {
           sDME += "&INDEX=ZAPSET9";
           sDME += "&KEY="+ parmHistDate +"===";
           sDME += "&SELECT=PROC-STAT-FLAG^%21%3DNEW%26PROC-STAT-FLAG^%21%3DREST";
     }

     

    Thanks

    Kwane McNeal
    Private
    Private
    Veteran Member
    (1314 points)
    Veteran Member
    Posts:438


    Send Message:

    --
    04/12/2019 10:04 AM
    The simplest method, would be to change the MAX=99, to MAX=5000
    PD
    Technical Assoc Manager
    Private
    Veteran Member
    (100 points)
    Veteran Member
    Posts:52


    Send Message:

    --
    04/12/2019 10:07 AM
    But I want the top 5000 records
    David Williams
    Private
    Private
    Veteran Member
    (3160 points)
    Veteran Member
    Posts:1064


    Send Message:

    --
    04/12/2019 10:18 AM

    DME isn't SQL which allows this type of calculation. If the Index doesn't sort the data the way you need, and you can't add your own custom index, then you're pretty much out of luck. You'd have to load all of the data and use JavaScript to calculate the top 5000.

    Maybe you can add a table view which applies the look up you want.

    David Williams
    PD
    Technical Assoc Manager
    Private
    Veteran Member
    (100 points)
    Veteran Member
    Posts:52


    Send Message:

    --
    04/12/2019 11:25 AM
    Ok...thank you all
    You are not authorized to post a reply.