Read Logan from CB55

 1 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
Jeff Pratte
Basic Member
Posts: 13
Basic Member
    Gang,

    I would like to read a Logan table (WFVARIABLE) from inside of CB55.

    I have a working read of CBPAYMENT:

    function CheckForDup()
    var thisDup = 0;
    var myTransNumber = lawForm.getDataValue("CBM-REFERENCE-NO");
    var s = "http://" + window.location.host + portalWnd.DMEPath;
    s += "?PROD="+portalWnd.oUserProfile.getAttribute("productline");
            s += "&FILE=CBPAYMENT";
            s += "&FIELD=REFERENCE_NO";
            s += "&SELECT=REFERENCE-NO=" + myTransNumber;
            s += "&OUT=CSV&DELIM=~&NOHEADER=TRUE";

            var objhttp = portalWnd.objFactory.createInstance("HTTP")
            objhttp.Open("GET", s, false)
            objhttp.Send("UserInfo")
    cReturn = objhttp.responseTEXT

    if(cReturn > '') {thisDup = 1;}
    return thisDup ;
    }

    Now I am trying to do something similar for WFVARIABLES.

    This is what I have so far:

    function CheckForDupTwo()
    {
    var workUnit = 0;
    var field = 0;
    var seq = 0;
    alert('CheckForDupTwo');
    //function GetMMDistInfo(workUnit,field,seq) { 
    var  logancall = new DMEObject("LOGAN", "WFVARIABLE")
    logancall.out = "JAVASCRIPT"
    logancall.field = "workunit;variable-name;wf-seq-nbr;variable-value"
    logancall.index = "wfvset1"
    logancall.max = "1"
    logancall.xida = true
    logancall.key = workUnit + "=" + field + "=" + seq
    logancall.func = "FinishMMDist()"
    DME(logancall, "jsreturn")
    // you cannot return the results from this function -> return FinishMMDist()
    return thisDup ;
    }

    I know the values for the read are set to zero right now. When I run this is get this error message:
    SCRIPT5009: 'DMEObject' is undefined 

    What do I need to do to fix this?

    Thanks, Jeff

    Robert Spurr
    Veteran Member
    Posts: 130
    Veteran Member
      I know you were probably looking for something constructed in your format but I couldn't make it work so I thought I would supply something that does work. Hope it helps.

      //Specfic values for testing
      var workUnit = "24837";
      var field = "RQH_COMPANY";
      var seq = "1";

      //DME call
      var s = "?PROD=LOGAN";
      s += "&FILE=WFVARIABLE";
      s += "&INDEX=WFVSET1&KEY=" + workUnit + "=" + field + "=" + seq;
      s += "&FIELD=WORKUNIT;VARIABLE-NAME;WF-SEQ-NBR;VARIABLE-VALUE";
      s += "&MAX=1&OUT=XML";

      var sReturn = portalWnd.httpRequest(portalWnd.DMEPath + s);

      if (!sReturn || sReturn.status)
      {
      var msg="Error calling DME ";

      msg += (sReturn
      ? "(status code): " + sReturn.status
      : "bad server response.");
      alert(msg);
      return true;
      }

      var vObjDMEXML = new portalWnd.DataStorage(sReturn);

      var vRecord = vObjDMEXML.document.getElementsByTagName("RECORD");

      if (vRecord.length == 0)
      {
      //enter your error process
      return true;
      }

      vCols = vRecord[0].getElementsByTagName("COL");

      alert(vCols[0].firstChild.data);