Previous Next

AddNumber( ) method (JsonArray)
Creates one or more new elements, setting each element’s value to a JSON number value represented by the CHARACTER parameter and adds it to the JsonArray.
This method is useful in situations where none of the ABL numeric data types is used to hold a numeric value. For example, 10E+100.
On successful execution, this method returns the index of the newly added element. If the value is an ABL array, the index of the last element added is returned.
Return type:
Access:
Applies to:
 
Syntax 
AddNumber( INPUT value AS CHARACTER )
 
AddNumber( INPUT array-value AS CHARACTER EXTENT )
 
AddNumber( INPUT index AS INTEGER,
           INPUT value AS CHARACTER )
 
AddNumber( INPUT index AS INTEGER,
           INPUT array-value AS CHARACTER EXTENT )
 
When this method is called with one parameter, the new elements are added to the end of the JsonArray. When this method is called with two parameters, the AVM inserts the new elements after the element at the specified index.
If the overloading with an ABL array parameter is used, the AVM uses each element of the ABL array to initialize a new element of the JsonArray.
value
A CHARACTER expression representing a numeric value to which the new element is to be set. The value must match the pattern for valid JSON number values. These may be integers ([-]dddd), decimals ([-]ddd.ddd), or scientific notation, ([-]ddd[.ddd]e[+|-]ddd). If the value is the Unknown value (?), the element is set to the a JSON null value.
If the value is not a valid JSON number value or is an empty string (""), a JsonError is raised.
array-value
A CHARACTER array containing values used to initialize a set of new elements. Each element of the ABL array is used to initialize one new element in the JsonArray. The JsonArray grows by as many elements as are in the ABL array. The value must match the pattern for valid JSON number values. These may be integers ([-]dddd), decimals ([-]ddd.ddd), or scientific notation ([-]ddd[.ddd]e[+|-]ddd). Any Unknown value (?) within the ABL array will result in a JSON null value in the JsonArray.
A JsonError is raised if:
*
array-value is the Unknown value (?) or indeterminate.
*
index
An INTEGER identifying the element after which the new element or elements are added. Indexing into JsonArrays is 1-based. For example, myArray:AddNumber(8, "10e15") inserts a JSON number value as element 9 into the JsonArray. All elements starting with the original ninth element will be shifted by one position.
If index is 0, the new element is inserted at the beginning of the array making that new elements index 1.
If index is the Unknown value (?), less than 0, or is larger than the length of the array, a JsonError is raised.

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.