For years I have been using this syntax to get the results from an AGS call:
var sMsgNbr = sAGSInfo.selectSingleNode("//MsgNbr").text;
This seems to work only in IE. Gets an 'undefined' in Chrome and Firefox.
This workaround seems to work on all 3 browsers.
var vNew1 = sAGSInfo.getElementsByTagName("MsgNbr")[0]; var vNew2 = vNew1.childNodes[0]; var vNewMsg = vNew2.nodeValue;
Does anyone have sample DME and AGS call syntax that will work both in IE and Chrome?
We just finished getting a custom form working in V10 on IE working around the JS and object behavior changes only to find that the DME and AGS calls are not working when users try to use it in Chrome.
Thanks.
I recently ran into this same issue with a client. The DME and AGS calls are working but IE11 stores the return data in a different spot than Chrome and FireFox.
The solution I used was to check the browser userAgent for IE and then pull from the correct location. One thing we ran into with this was that the data from Chrome and Firefox needed to be trimmed of character-return/line feeds.
var ua = navigator.userAgent; //ZD032717 - Update userAgent check to IE11(Trident) var trident = ua.indexOf('Trident/'); if (trident > 0) { vELcommentArray = vCols[0].firstChild.data; } else { var stringToReplace = vCols[0].firstChild.wholeText; vELcommentArray= stringToReplace.replace(/[\n\r]+/g, ''); }
I have found that Chrome returns the columns as a huge array. So my solution is to increment a column index by the number of columns in the returned result set.
Regarding DME conversion from IE to Chrome:
Per an Infor post, you can store the individual 'record' in a new portalWnd.DataStorage and then pull off the individual columns using the .getElementCDataValue('COL', ). I have attached a sample of before & after code for the DME data.
However - going back to the original request, has anyone been able to fix the Design Studio code surrounding the .selectSingleNode("//MsgNbr" return from the AGS call to work in Chrome?
Thanks - Shawn
Sorry - I re-read the original post and found that RaguRagu had already found a solution for the sAGSInfor.selectSingleNode("//MsgNbr".text;
Below is the before/after code I am using to get the results from the AGS call. Before code works in IE only & After code works in both IE & Chrome.
var sMsgNbr = sAGSInfo.selectSingleNode("//MsgNbr".text;
var sMsgNbr = sAGSInfo.getElementsByTagName("MsgNbr"[0].childNodes[0].nodeValue;
Is anyone doing this differently? Is there there a better solution?
I tried to incorporate your solution into my script with the getElementCDataValue('COL', 0) for Edge, I get the message that it is not a function when using the Devloper Console. What version of Design Studio is this API in.
Thank You for your help.
Scott
I was able to confirm in works in Edge. We are on version 10.0.10.0.592. I originally got the code from an Infor post and I believe the getElementCDataValue function was added somewhere in version 10. Not sure exactly what exact version.