Add values to listbox from dme query

Sort:
You are not authorized to post a reply.
Author
Messages
George Graham
Veteran Member
Posts: 201
Veteran Member
    Looking for the java syntax to add values to a list box on form init from the results of a DME query. This isn't a field from the form so can't simply attach that to the object.

    I just can't find my notes on how to add the text, phrase and values to the object.
    George Graham
    Veteran Member
    Posts: 201
    Veteran Member
      Never mind - found it.
      Ragu Raghavan
      Veteran Member
      Posts: 469
      Veteran Member

        Code below does a DME query on APINVOICE and populates list box l70 with all the Invoices for the specified Vendor

        var s = portalWnd.DMEPath;
        s += "?PROD=" + sPDL;
        s += "&FILE=APINVOICE";
        s += "&FIELD=INVOICE;INVOICE-DTE;";
        s += "&INDEX=APISET1";
        s += "&KEY=" + vCompany + "=" + vVendor;
        s += "&OUT=XML";
        // alert("s " + s);

        var sReturn=portalWnd.httpRequest(s);

        if (!sReturn || sReturn.status)
        {
        alert("status s " + sReturn.status);
        return true;
        }

        var vObjXML = new portalWnd.DataStorage(sReturn);
        var vRecords = vObjXML.document.getElementsByTagName("RECORD");
        // alert("vrecords " + vRecords.length + " " + vRecords.text);

        //_l70 is the listbox
        var InvList = document.getElementById("VALUES_l70");

        // alert(vCols[0].firstChild.data + " " + vCols[1].firstChild.data);

        for (var ix=0; ix < vRecords.length - 1 ; ix++)
        {
        var vCols = vRecords[ix].getElementsByTagName("COL");
        var str1 = vCols[0].firstChild.data;
        var str2 = vCols[1].firstChild.data;
        // alert("str2 " + str2);
        var str3 = str1 + " " + str2;
        ListVal = document.createElement("span");
        ListVal.setAttribute("tran",str1);
        ListVal.setAttribute("disp",str1);
        ListVal.setAttribute("text",str3);

        InvList.appendChild(ListVal);
        }
        You are not authorized to post a reply.