[progress Communities] [progress Openedge Abl] Forum Post: Re: Cannot Transform Json Number...

  • Thread starter Thread starter Mike Fechner
  • Start date Start date
Status
Not open for further replies.
M

Mike Fechner

Guest
Sounds like an expected functional limitation (as Progress added a specific error message for this). Which Progress Version have you tried this on? Von: Valeriy Bashkatov [mailto:bounce-Arelav2@community.progress.com] Gesendet: Montag, 20. November 2017 10:17 An: TU.OE.Development@community.progress.com Betreff: [Technical Users - OE Development] Cannot transform JSON number value to ABL decimal value, JSON value has an exponent. Update from Progress Community Valeriy Bashkatov Hi, Our client encountered the problem of getting a Json array in which one element has a value in exponential form. @Call to Progress.Json.ObjectModel.JsonObject:GetDecimal( ) failed. Cannot transform JSON number value to ABL decimal value, JSON value has an exponent. (16061) We get this value in the code like this: disk_share.face_value = (IF oTmpIt:Has("face_value") THEN oTmpIt:GetDecimal("face_value") ELSE 0) Example of value: "face_value": 6.25e-6, We haven't found other than this: IF oTmpIt:Has("face_value") THEN DO: ASSIGN cStr = oTmpIt:GetJsonText("face_value"). IF INDEX(cStr, "e") > 0 THEN DO: ASSIGN base = DECIMAL(SUBSTRING(cStr, 1, INDEX(cStr, "e") - 1)) power = INTEGER(SUBSTRING(cStr, INDEX(cStr, "e") + 1 )) disk_bond.face_value = base * EXP(10, power). END. ELSE ASSIGN disk_bond.face_value = oTmpIt:GetDecimal("face_value"). END. This seems to work, but maybe in ABL (4GL) there is another more efficient way to do this with the built-in ABL functions? Regards, Valeriy View online You received this notification because you subscribed to the forum. To stop receiving updates from only this thread, go here . Flag this post as spam/abuse.

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