DME Query

 3 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
Nabil
Veteran Member
Posts: 61
Veteran Member

    I'm trying to add a field (EMS-DESCRIPTION) to this DME query in my form, but I get an error when I run it:

    function doDME()
    {
    	var sDME;
    	var vCompany = 1;
    	var vEmployee = lawForm.getFormValue("txtemployee");
    	
    	sDME ="?PROD=" + strPDL;
    	sDME +="&FILE=EMPLOYEE&FIELD=FICA-NBR-LAST4;FULL-NAME;EMS-DESCRIPTION;EMP-STATUS;HM-ACCT-UNIT;LOCATION.CODE;LOCATION.DESCRIPTION;COMPANY;EMPLOYEE";
    	sDME +="&SELECT=COMPANY%3D" + vCompany;
    	sDME +="%26EMPLOYEE%3D" + vEmployee;
    	sDME +="&OUT=XML";
    	//alert(sDME);
    	
    	var vDMEInfo = top.httpRequest(top.DMEPath + sDME);
    	var vObjDMEXML = new top.DataStorage(vDMEInfo);
    	var vRecords = vObjDMEXML.document.getElementsByTagName("RECORD");
    	if (vRecords.length == 0)
    	{
    		alert("Employee Not Found!");
    		return true;
    	}
    	var vCols = vRecords[0].getElementsByTagName("COL")
    	lawForm.setFormValue("txtficanbr",vCols[0].firstChild.data);
    	lawForm.setFormValue("txtfullname",vCols[1].firstChild.data);
    	lawForm.setFormValue("txtstatus",vCols[2].firstChild.data);
    	lawForm.setFormValue("txtacctunit",vCols[3].firstChild.data);
    	lawForm.setFormValue("txtlocationcode",vCols[4].firstChild.data);
    	lawForm.setFormValue("txtlocationdesc",vCols[5].firstChild.data);
    	lawForm.setFormValue("txtstatdesc",vCols[6].firstChild.data);
    	return true;	
    }

    Any ideas why?

    Thanks

    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      First thing that jumps out is that you haven't defined the strPDL variable within your function.
      David Williams
      John Henley
      Posts: 3353
        Use EMSTATUS.DESCRIPTION=
        Thanks for using the LawsonGuru.com forums!
        John
        Nabil
        Veteran Member
        Posts: 61
        Veteran Member
          Maybe it's because this DME query is set to look in the EMPLOYEE table here:
          table
           sDME +="&FILE=EMPLOYEE&FIELD=...

          EMS-DESCRIPTION exists in a different table EMSSTATUS.

          So, if I need it to look at a different table, would I need to create a separate DME call or just add it to the existing one?

          Thank you