The users would like to see the name of the Asset next to the asset number on the bottom portion of AM25.1. I wrote the DME query, and it works.
The first time I do an inquire, the name field will be random. If i go to page two, I see page 1's Asset number name next to page 2's asset number. Page three sees page two's name, and so on (basically my dme query is one page behind).
Also, I only get a name for the first Asset number. I'm not really sure how I loop my script to populate through all 22 Asset's attached per page. Any help would be appreciated.
Here's my query:
function FORM_OnAfterTransaction(fc) { //was transaction successful? if (formState.agsError) return;
//get Asset number var vAst=lawForm.getFormValue("out9"); //alert("asset number is "+vAst);
var vDesc = "" lawForm.setFormValue("text11","");
//Do DME call var s = portalWnd.DMEPath; s += "?PROD=" +strPDL; s += "&FILE=AMASSET&FIELD=DESCRIPTION;&INDEX=ASTSET1"; s += "&KEY=" + vAst; s += "&XCOLS=TRUE&XKEYS=TRUE&XRELS=TRUE&XCOUNT=TRUE&XIDA=TRUE&OUT=XML"; alert("string is "+s)
//send DME call to server var vDMEInfo = portalWnd.httpRequest(s); //alert(vDMEInfo.xml);
// DME Error Checking if(!vDMEInfo||vDMEInfo.status) { var msg="Error calling DME, "; msg += (vDMEInfo? "(status code): "+vDMEInfo.status: "bad server response."); alert(msg); return true; }
//create an XML object to contain the DME data var vObjDMEXML = new portalWnd.DataStorage(vDMEInfo); var vRecords=vObjDMEXML.document.getElementsByTagName("RECORD"); if (vRecords.length == 0) return true;
var vCols=vRecords[0].getElementsByTagName("COL"); var vDesc = vCols[0].firstChild.data; //alert("Description is "+vDesc);
lawForm.setFormValue("text11",vDesc);
}
I wrote the DME query, and it works.
So have you tried putting an alert to display vAst and the rowNum before the dme call, then an alert after to display the returned value.
I thought that at first too and had logic in their such as:
if (lawForm.magic.FC == "I" || ...) But it may be needed for the Add/Change, what if deleting an Asset, you need to go through the logic to clear out the descriptions. You would also need to add the description if adding an asset tag.