Javascript AGS call with "Next"

 1 Replies
 0 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
Woozy
Veteran Member
Posts: 709
Veteran Member
    I have a custom 4GL form that includes a grid with rows for all the employees of a supervisor, along with additional data (vacation used & available).  This flow makes use of Next/Previous functionality to browse through records when there are more subordinates than the form allows.  TThe form works perfectly using the Next/Previous functionality.


    Now we've been given a requirement to build an EMSS version of this form.  Do do this,  We want to retrieve all of the records from the form and store them in an array we can then use to build the EMSS screen.  We need to use an AGS call to retrieve the data from the custom 4GL form and display it in an EMSS screen, and we need to be able to "next" through the form to get all the records.  

    In the Javascript AGS call, no matter what we do we always get the first 11 subordinate records returned.  How can we get this call to correctly perform an Inquire followed by a Next (or more than one next)?  It seems to me that if the Next works on the form, it should work on the AGS call.

    Here is the AGS call we are using:


    var obj = new AGSObject(authUser.prodline, "ZY92.1");
        obj.evt = "CHG";
        obj.rtn = "DATA";
        obj.lfn = "ALL";
        obj.tds = "IGNORE";
        obj.out = "XML";
        obj.field = "FC=" + fc  // fc = 'I' first time through, then '+' (%2b) with subsequent calls until no additional records remain.
                  + "&DKEY-PROTECTED=" + nxtGroup  // 'nxtGroup is populated with the DKEY-PROTECTED value from the previous return (or zeros if 'I')
                  + "&HSU-COMPANY=1"
                  + "&HSU-EMPLOYEE=" + empU
                  + "&AGS-FLAG=1"
                  + "&YEAR-SEL=" + year;
        obj.func = "parent.processTotals(parent.year, parent.fc, '92')";
        obj.debug = false;
        AGS(obj, "jsreturn");


    We've used Fiddler to see what the form is doing, and have tried to duplicate it in the AGS call, without success.

    Any ideas?  Thanks!
    Kelly Meade
    J. R. Simplot Company
    Boise, ID
    Woozy
    Veteran Member
    Posts: 709
    Veteran Member
      My counterpart was able to figure this out and get it working by changing "obj.evt" to "obj.event" and spelling out "CHANGE" instead of "CHG":


      var obj = new AGSObject(authUser.prodline, "ZY92.1");
          obj.event = "CHANGE";
          obj.rtn = "DATA";
          obj.lfn = "ALL";
          obj.tds = "IGNORE";
          obj.out = "XML";
          obj.field = "FC=" + fc  // fc = 'I' first time through, then '+' (%2b) with subsequent calls until no additional records remain.
                    + "&DKEY-PROTECTED=" + nxtGroup  // 'nxtGroup is populated with the DKEY-PROTECTED value from the previous return (or zeros if 'I')
                    + "&HSU-COMPANY=1"
                    + "&HSU-EMPLOYEE=" + empU
                    + "&AGS-FLAG=1"
                    + "&YEAR-SEL=" + year;
          obj.func = "parent.processTotals(parent.year, parent.fc, '92')";
          obj.debug = false;
          AGS(obj, "jsreturn");


      Boy - it's the little stuff like this that makes you pull your hair out...
      Kelly Meade
      J. R. Simplot Company
      Boise, ID