Is there anything in the ABL for converting the arrays that are returned from some of the Rollbase SOAP API methods into ABL structures like a temp-table or ProDataSet?
For instance, the selectQuery method returns a LONGCHAR that contains XML with a 2 dimensional array of <item> within <arr>, without any of the table or column tags that would be needed for the ABL READ-XML methods to work.
I'm getting ready to write something to parse the query results into a dynamic temp-table, but I'd rather not re-invent the wheel if this functionality already exists and I'm just not looking in the right place for it.
Thanks
Is there anything in the ABL for converting the arrays that are returned from some of the Rollbase SOAP API methods into ABL structures like a temp-table or ProDataSet?
For instance, the selectQuery method returns a LONGCHAR that contains XML with a 2 dimensional array of <item> within <arr>, without any of the table or column tags that would be needed for the ABL READ-XML methods to work.
I'm getting ready to write something to parse the query results into a dynamic temp-table, but I'd rather not re-invent the wheel if this functionality already exists and I'm just not looking in the right place for it.
Thanks
I used the JSON output and had to populate the table myself.
There is a pitfull with date fields in the JSON output: Those are represented in the Form of
NEW Date (2013/12/24)
unquoted.... No need to mention, that they fail to translate easy into an ABL date.
This is the code that creates the output:
DEFINE VARIABLE in1 AS CHARACTER NO-UNDO INIT "".
DEFINE VARIABLE in2 AS LOGICAL NO-UNDO.
DEFINE VARIABLE lcLongChar AS LONGCHAR NO-UNDO INIT "".
/* note that the value of streetAddr2 is nil for these records - that is reflected accurately in the results*/
ASSIGN in0 = cSessionID.
ASSIGN in1 = "SELECT city, name, annual_revenue, streetAddr2 FROM account1". /* this does work for some reason */
RUN selectQuery IN hIWebServices(in0, in1, 3, OUTPUT lcLongChar).
This is what is in the longchar result:
<selectQueryReturn xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:soapenv="schemas.xmlsoap.org/.../item><item>Bluth Company</item><item>10000.00000000</item><item xsi:nil="true"></item></arr></item><item><arr><item>Omaha</item><item>Bob's House of Toothpicks</item><item>10000.00000000</item><item xsi:nil="true"></item></arr></item><item><arr><item>Omaha</item><item>Beef Jerky R Us</item><item>1000000.00000000</item><item xsi:nil="true"></item></arr></item></arr></selectQueryReturn>
Please ignore the /* this does work for some reason */ That was just a note for myself as I was using to learn how to call the API the right way that I forgot to clean up before I posted the code - it has nothing to do with the current question.
Thanks for the note about the date Mike. With the SOAP calls that I'm using the dates come back in this format:
2013-10-15 00:00:00.0
We'll have to do a little adjusting with those to map them to ABL date or datetime also.