• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Question Is This A Bug? Can't Pass Unknown Value "?" To The Add Method.

Cecil

17+ years progress programming and still learning.
#1
Ref:
OpenEdge 11.6.3
Windows 10 Pro

The following example code fails with the errors 13843 and 14457.

Code:
USING Progress.Json.ObjectModel.JsonObject.
DEFINE VARIABLE oJson       AS class JsonObject    NO-UNDO.

oJson = NEW JsonObject().

oJson:Add("blarNumber",  12345).
oJson:Add("blarString", "asdasda").
oJson:Add("blarUnkown", ?).
Error Message:
Screen Shot 10-12-17 at 02.53 PM.PNG
In the documentation it says passing a value of unknown will result in a JSON null value.

Screen Shot 10-12-17 at 02.55 PM.PNG

My workaround is to wrap the unknown value with an integer function. My question, is this a bug?
If it is a bug, I guess it won't be fixed because it's been like this for too many revisions of OpenEdge.

Code:
USING Progress.Json.ObjectModel.JsonObject.
DEFINE VARIABLE oJson       AS class JsonObject    NO-UNDO.

oJson = NEW JsonObject().

oJson:Add("blarNumber",  12345).
oJson:Add("blarString", "asdasda").
oJson:Add("blarUnkown", INTEGER(?) ).
 

Stefan

Active Member
#3
You say integer, I say character and that's the problem, the signature determines which method is called.

Which datatype does a literal unknown have?

So you will need to help the compiler by either explicitly adding a function around the unknown or using a variable with a specified data type set to unknown.
 

Cecil

17+ years progress programming and still learning.
#4
You say integer, I say character and that's the problem, the signature determines which method is called.

Which datatype does a literal unknown have?

So you will need to help the compiler by either explicitly adding a function around the unknown or using a variable with a specified data type set to unknown.
I guess you are right, the limitation is the compiler not knowing what data type the 'unknown value' is related to. Maybe, the documentation should be updated to reflect this querk of passing constant parameter values vs. variables vs. functions.