Selec Top(5000) in DME call

 4 Replies
 2 Subscribed to this topic
 78 Subscribed to this forum
Sort:
Author
Messages
PD
Veteran Member
Posts: 58
Veteran Member

    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
    Veteran Member
    Posts: 479
    Veteran Member
      The simplest method, would be to change the MAX=99, to MAX=5000
      PD
      Veteran Member
      Posts: 58
      Veteran Member
        But I want the top 5000 records
        David Williams
        Veteran Member
        Posts: 1127
        Veteran Member

          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
          Veteran Member
          Posts: 58
          Veteran Member
            Ok...thank you all