I'm trying to run a query in the background when my form opens up and pass that value to a form later. Here is what i have so far but I cant seem to acquire any data that the query would return. getElements by name hasnt worked for me yet. Can anyone help?
function portalpage_OnInit() { var vProd = portalWnd.oUserProfile.getAttribute("productline"); var vPlan = "" var vEmp = portalWnd.oUserProfile.getAttribute("employee");
var vDmeString = "?PROD=" + vProd + "&FILE=EMTATRANS&INDEX=ETTSET1&KEY=200=" + vEmp + "===&FIELD=EMPLOYEE;PLAN-NAME;DATE;TYPE;TA-HOURS&SELECT=TYPE^%3DA&OUT=XML";
var vDMEInfo = portalWnd.httpRequest(top.DMEPath + vDmeString);
alert(vProd); alert(vEmp); alert(vDmeString); alert(vDMEInfo); }
I've formatted my query to work properly in portal with the csv now but i dont understand the "GET" process. Specifically, this part:
Can you elaborate?
//Return value from table
var objhttp = new ActiveXObject("Msxml2.XMLHTTP")
objhttp.Open("GET", sDME, false)
objhttp.Send("UserInfo")
sReturn = objhttp.responseTEXT
Thanks Gary, i ended up getting your method to return values. I need to order by date though the query results. Is there a method to sort the results? Then to pass the results via variable into a User Designed form that i've placed on the portal page the variable created in the portal page i'm trying to use: function FORM_OnInit() but i dont think it's being referenced properly. I need to put the data returned into a text3 box and then inquire on the form.
Thanks! That worked for the sort by date order. Do you know how i pass on a variable to a form from the portal query?
map the varialbes from the properties of the portal page.
I have been asked to expand on the comment about parsing more than one record. In the example I had the line var vCols = vRecords[0].getElementsByTagName("COL") which assumes only 1 record passed back. If you have more than one you need to loop through the returned array of vRecords and parse the COL fields for each record like such:
for (var i=0;i
var vCols = vRecords[i].getElementsByTagName("COL")
.... parse each field the same way and process them for each record
}
The difference is you will need to set vCols for each record and then parse each occurance of vCols for the fields on the record within the loop when more than one record returned.
Gary Davies
www-automated-worklfow.com
OK for some reason the for loop did not get displayed properly
it should be
for (var i=0;i so that it will loop through setting i to the record number until there are no more records Gary Davies www.automated-workflow.com
so that it will loop through setting i to the record number until there are no more records
www.automated-workflow.com
The less than character is not letting this post to show properly, so one more time but I will substitue the less than character with the phrase "less than"
for (var i=0;i "less than" vRecords.length;i++)