Forum Post: RE: REST Adapter issues (OE 11.4)

  • Thread starter Thread starter sjellin.dovetail
  • Start date Start date
Status
Not open for further replies.
S

sjellin.dovetail

Guest
Hi All, Sorry for the late reply - with more info - hope someone is still able to help :) If I use very large decimals (like dynamics obj numbers) - it winds up in scientific notation - here is some sample code At the bottom is the result calling it via FireFox (to rule out Postman doing something odd). Note: - the output is converting to scientific as the write-json(longchar,file) - do not change to scientific notation. If the output dataset is pushed to a procedure expecting DATASET-HANDLE - it fails as openedge then doesn't map the E back to decimal. What I found was ... http://json.org/ which shows that number CAN have E .. which the output seems to do, but the input doesn't seem to do - this is perhaps rather a bug ?? @openapi.openedge.export FILE(type="REST", executionMode="singleton", useReturnValue="false", writeDataSetBeforeImage="false"). /********************************************************************** * Copyright (C) 2006-2013 by Consultingwerk Ltd. ("CW") - * * www.consultingwerk.de and other contributors as listed * * below. All Rights Reserved. * * * * Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY * * KIND, either express or implied. * * * * Contributors: * * * **********************************************************************/ /*------------------------------------------------------------------------ File : testScientific Purpose : Syntax : Description : Author(s) : stevenj Created : Fri May 22 09:51:07 CAT 2015 Notes : ----------------------------------------------------------------------*/ ROUTINE-LEVEL ON ERROR UNDO, THROW. USING FW.Rest.* FROM PROPATH . USING Progress.Lang.* FROM PROPATH . CLASS FW.Rest.testScientific: define temp-table breakme no-undo field bignumberfield as decimal. define dataset dsbreakme FOR breakme. define VARIABLE lcbreakme as longchar no-undo. @openapi.openedge.export(type="REST", useReturnValue="false", writeDataSetBeforeImage="false"). METHOD PUBLIC VOID mbreakme (OUTPUT DATASET FOR dsbreakme, OUTPUT plcbreakme as longchar): create breakme. bignumberfield = 10000000.1. create breakme. bignumberfield = 100000000.1. create breakme. bignumberfield = 1000000000.1. create breakme. bignumberfield = 10000000000.1. create breaKme. bignumberfield = 10000000.111. create breakme. bignumberfield = 100000000.111. create breakme. bignumberfield = 1000000000.111. create breakme. bignumberfield = 10000000000.111. DATASET dsbreakme:WRITE-JSON("LONGCHAR",plcbreakme). END METHOD. END CLASS. -- Output put {"response":{"dsbreakme":{"dsbreakme":{"breakme":[{"bignumberfield":1.00000001E7},{"bignumberfield":1.000000001E8},{"bignumberfield":1.0000000001E9},{"bignumberfield":1.00000000001E10},{"bignumberfield":1.0000000111E7},{"bignumberfield":1.00000000111E8},{"bignumberfield":1.000000000111E9},{"bignumberfield":1.0000000000111E10}]}},"plcbreakme":"{\"dsbreakme\":{\"breakme\":[{\"bignumberfield\":10000000.1},{\"bignumberfield\":100000000.1},{\"bignumberfield\":1000000000.1},{\"bignumberfield\":10000000000.1},{\"bignumberfield\":10000000.111},{\"bignumberfield\":100000000.111},{\"bignumberfield\":1000000000.111},{\"bignumberfield\":10000000000.111}]}}"}}

Continue reading...
 
Status
Not open for further replies.
Back
Top