Hi,
I'm trying to add value maps to a process array but am receiving the error "msg.array.element.mismatch". If i declare a local array I'm able to populate each element with a valuemap. However, when doing the same with a Process Variable array the mentioned error is returned.
I'm trying to rebuild the getFormRateItemValues operator so that it's able to parse a large amount of data. Currently, if Service Catalog form has a table with several column and a user submits a request with ~100 rows, the getFormRateItemValues operator will fail as it's not able to parse the response.
Here is the code in the out of the box operator. (Which may fail on large requests)
var l_numFields = 0;
var l_arrayFormIDsValues = new Array();
if (Process[OpName].Result == 1) {
Process.Successful__ = "TRUE";
l_numFields = Process[OpName].SoapResponseData.getFormRateItemValuesReturn[0].form[0].form.length;
logEvent(0, "GetFormFieldsBySubsID", "Number of fields in form: " + l_numFields);
for(var i = 0; i <l_numFields; i++) {
vmap = newValueMap();
vmap.strKey = Process[OpName].SoapResponseData.getFormRateItemValuesReturn[0].form[0].form[i].ID[0].text_;
vmap.strValue = Process[OpName].SoapResponseData.getFormRateItemValuesReturn[0].form[0].form[i].value[0].text_;
l_arrayFormIDsValues[i] = vmap;
}
Process.arrayFormResults = l_arrayFormIDsValues;
return;
}
else {
logEvent(0, "ERROR", "SOAP call getFormRateItemValues() failed");
throw "SOAP call getFormRateItemValues() failed";
}
I'm trying to change this so that it loops through the returned data 50 lines at a time. Here's what I have so far, this code is not working and returning the mentioned error. This code is in a javascript operator contained within a loop. The loopStart and loopEnd variables are incremented up by 50 after each run.
for(var i = Process.loopStart; i < Process.loopEnd && i < Process.getFormRateItemValuesLength; i++) {
vmap = newValueMap();
vmap.strKey = Process.getFormRateItemValues.SoapResponseData.getFormRateItemValuesReturn[0].form[0].form[i].ID[0].text_;
vmap.strValue = Process.getFormRateItemValues.SoapResponseData.getFormRateItemValuesReturn[0].form[0].form[i].value[0].text_;
Process.arrayFormResults[i] = vmap;
}
However, if I declare a local array then set the process array equal to the local array it will work, but I can't figure out how to get it to work with a loop...
Any help is appreciated.
Thanks!