JamesBowen
19+ years progress programming and still learning.
OE 11 issue with jsonarray class object. See error below.
I've tried looking a the KB no entry found.
THIS WORKS:
THIS DOES NOT WORK. WHY?
I've tried looking a the KB no entry found.

THIS WORKS:
Code:
USING Progress.Json.ObjectModel.JsonArray.
DEFINE VARIABLE a AS INTEGER EXTENT 3 INITIAL [3,2,1].
DEFINE VARIABLE b AS CHARACTER EXTENT 2 INITIAL ['Hello','world'].
DEFINE VARIABLE c AS DATE EXTENT 2 INITIAL [9/20/10,10/10/10].
DEFINE VARIABLE myArr AS CLASS JsonArray NO-UNDO.
myArr = NEW JsonArray(a). /* myArr is now [3, 2, 1] */
myArr:Add(TRUE). /* myArr is now [3, 2, 1, true] */
myArr:Add(b). /* myArr is now [3, 2, 1, true, “Hello”, “world”] */
myArr:Add(2, c). /* myArr is now [3, 2, “2010-09-20”, “2010-10-10”, 1, true, “Hello”, “world”]
THIS DOES NOT WORK. WHY?
Code:
USING Progress.Json.ObjectModel.JsonArray.
DEFINE VARIABLE a AS INTEGER EXTENT .
DEFINE VARIABLE b AS CHARACTER EXTENT 2 INITIAL ['Hello','world'].
DEFINE VARIABLE c AS DATE EXTENT 2 INITIAL [9/20/10,10/10/10].
DEFINE VARIABLE myArr AS CLASS JsonArray NO-UNDO.
EXTENT (a) = 3.
a[1] = 3.
a[2] = 2.
a[3] = 1.
myArr = NEW JsonArray(a). /* myArr is now [3, 2, 1] */
myArr:Add(TRUE). /* myArr is now [3, 2, 1, true] */
myArr:Add(b). /* myArr is now [3, 2, 1, true, “Hello”, “world”] */
myArr:Add(2, c). /* myArr is now [3, 2, “2010-09-20”, “2010-10-10”, 1, true, “Hello”, “world”] */