PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 08/01/2014 9:42 AM by  heidi
Design Studio - Population of list box from a query result (8.0.3 env and 8.1 apps)
 5 Replies
Sort:
You are not authorized to post a reply.
Author Messages
Sreenivasa Komma
Private
Private
Basic Member
(39 points)
Basic Member
Posts:19


Send Message:

--
11/29/2007 10:54 AM
    Hi,

    I have a list box field defined in design studio XML like this:

    <fld al="left" col="45" defval="" det="" id="nvalu10" nbr="_f103r0" nm="PCT-NEW-VALUE-1" oc="0" par="TF0-1" row="1" seltype="" sz="30" tp="Select"/>

    I want to populate the list from the result set of a DME query. I don't want to code vals entries like this for the above field

    <vals>Disp="1846" Tran="1846" id="vals18">John Young</vals>

    in the XML but want to dynamically generate these using Javascript.

    Anyone did this before.

    Thanks in advance..
    Sreeni
    John Henley
    Private
    Private
    Senior Member
    (9629 points)
    Senior Member
    Posts:3227


    Send Message:

    --
    11/29/2007 11:35 AM
    Thanks for using the LawsonGuru.com forums!
    John
    Sreenivasa Komma
    Private
    Private
    Basic Member
    (39 points)
    Basic Member
    Posts:19


    Send Message:

    --
    11/29/2007 12:05 PM
    John

    I can not Thank you enough for the timely help. I have been strugging to get this to work for the past 3-4 days and with the code snippet you posted I finally got a breakthrough.

    Thanks much.. I really appreciate what you are doing thru this forum.

    -Sreeni
    Sreenivasa Komma
    Private
    Private
    Basic Member
    (39 points)
    Basic Member
    Posts:19


    Send Message:

    --
    11/29/2007 12:13 PM
    here is how I did it.

    function populateList(f)
    {
    var fieldKey;
    var hrbcRecs;
    var hrbcCode;
    var hrbcDesc;
    var arrCOL;
    var hrbcList;
    dmeStr = "?XCOLS=TRUE&XKEYS=TRUE&XCOUNT=TRUE" +
    "&XRELS=FALSE&XIDA=FALSE&XNEXT=FALSE" +
    "&PROD=" + portalObj.getUserVariable("PRODLINE") +
    "&FILE=PCODES" +
    "&FIELD=CODE;DESCRIPTION;" +
    "&INDEX=PCOSET1" +
    "&KEY=41" +
    "&SELECT=ACTIVE-FLAG%3DA" +
    "&MAX=1000" +
    "&OUT=XML";

    dmeCall = portalWnd.httpRequest(portalWnd.DMEPath + dmeStr);

    if (!dmeCall || dmeCall.status) {
    alert("System Error. Contact HRIS. Error: PCODES HRBC DME");
    return false;
    }

    dmeDS = new portalWnd.DataStorage(dmeCall);

    try {
    hrbcRecs = dmeDS.document.getElementsByTagName("RECORD");
    alert(hrbcRecs.length);
    if (hrbcRecs.length == 0)
    {
    alert("System Error. Contact HRIS. Error: No HRBC values");
    return false;
    }
    } catch(err) {
    alert("System Error. Contact HRIS. Error setting HRBC code " + err);
    return false;
    }

    hrbcCode = new Array(hrbcRecs.length);
    hrbcDesc = new Array(hrbcRecs.length);

    //_f103r0 is the above field defined with tp="Select"
    var hrbcList = document.getElementById("VALUES_f103r0");

    var tVals;
    for (var i=0; i<hrbcRecs.length; i++)
    {
    arrCOL = hrbcRecs[i].getElementsByTagName("COL");
    hrbcCode[i] = arrCOL[0].firstChild.nodeValue;
    hrbcDesc[i] = arrCOL[1].firstChild.nodeValue;
    tVals = document.createElement("span");
    tVals.setAttribute("tran", hrbcCode[i]);
    tVals.setAttribute("disp",hrbcCode[i]);
    tVals.setAttribute("text",hrbcDesc[i]);
    hrbcList.appendChild(tVals);
    }

    return true;
    }

    heidi
    Private
    Private
    Basic Member
    (36 points)
    Basic Member
    Posts:12


    Send Message:

    --
    08/01/2014 8:35 AM

    Hello!

     

    First, I need to say how helpful Lawson Guru and all these posts are.  Reading through issues and resolutions posted here has certainly helped me, and countless others, I am sure, in getting through Lawson Design Studio questions and issues.

     

    This particular post was extremely helpful for me when creating a custom list box, based on a users location,  of selected pars from the ICLOCATION table.  The selected value is then passed to the Par Location field on IC81.1 for display/maintenance.

     

    I have one issue, however, when the returned  record set is greater than a count of 25.  It appears that the custom list box only displays the first 25, where the query would actually return a number greater than that.

     

    This populatelist function does not limit the array in any way, so the custom list box limit must be controlled elsewhere.

     

    Anyone have any ideas how I could find where it is controlled or  any work around for this to allow access to the remaining records that did not/could not display? 

    heidi
    Private
    Private
    Basic Member
    (36 points)
    Basic Member
    Posts:12


    Send Message:

    --
    08/01/2014 9:42 AM
    I have answered my own question . . .

    The location as to where to control the number of records displaying via the custom list box has been identified.   In the DME query, I have added, "&MAX=150".  All works as expected now.

    You are not authorized to post a reply.