SetInteger Method (JSONDATA)
10.8, PLBCMP GUI Only
The SetInteger method is used to create a JSON field with a integer type and place it into the current JSONDATA object. This method uses the following format:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
object
Required. A JSONDATA object previously declared.
return
Optional. A Numeric Variable that returns a pass (0) or fail (!0) value.
name
Required. A Character String Variable or literal that specifies a JSON field name for a JSONDATA object.
value
Required. A Character String Variable, literal, Numeric Variable, decimal number, or Numeric expression that specifies the JSON integer value for a JSON field.
index1
Optional. A Numeric Variable, decimal number, or Numeric expression that defines the first index of a JSON array that is being accessed.
index2
Optional. A Numeric Variable, decimal number, or Numeric expression that defines the second index of a JSON multi-dimensioned array that is being accessed.
index3
Optional. A Numeric Variable, decimal number, or Numeric expression that defines the third index of a JSON multi-dimensioned array that is being accessed.
Flags Affected: EOS, OVER, ZERO
Notes:
The EOS flag is always cleared.
The ZERO flag is set if the return value is zero. Otherwise, the ZERO flag is cleared for non-zero values.
The OVER flag is set if the return value must be truncated.
At runtime, the tokens $1, $2, and $3 that appear in the {name} parameter are replaced with the numeric values of the corresponding {index1}, {index2}, or {index3} parameters.
The error values returned in {return} are defined as follows:
|
Error |
Description |
|
1 |
Memory allocation error. |
|
5 |
JSON error type mismatch. |
|
6 |
JSON parse id error. Check SyntaxError method! |
|
7 |
JSON method input is null or invalid. |
If an error occurs, the JSONDATA object method 'SyntaxError' can be used to retrieve that last error that was generated.
The {value} parameter data must provide basic format(s) before it can be transformed into a proper JSON double type format that is set into the JSON field. If the {input} parameter is a Numeric Variable or decimal number, the PL/B value is used for the JSON double value output. If the {input} parameter is a Character Variable or literal, the string format can be one of the following formats:
|
Input |
Examples |
|
Decimal numbers |
1 to 9 digits, '+', '-' allowed |
|
Hexadecimal numbers |
0xf1ad, 0xA1E9 |
Valid {input} Examples:
|
Input |
Description |
|
"0.62" |
Leading digit '0' scanned and stops a '.'. Value is 0. |
|
"1.62" |
Leading digit '1' scanned and stops a '.'. Value is 1. |
|
"-12" |
Negative value ok. Value is -12. |
|
"-7.62" |
Negative value ok. Value is -7. The scanning stops at the decimal point. |
|
"+123" |
Positive value ok. Value is 12. |
|
" 789" |
Leading blanks ignored. Valus is 789. |
|
"987abc" |
Leading digits scanned and stops at non-digit (abc). Value is 987. |
Invalid {input} Examples:
|
Input |
Description |
|
NULL |
Null PL/B string is not allowed. |
|
'.62' |
Leading decimal point is not allowed. Leading digit required. |
|
'-.62' |
No leading digit before decimal point. |
|
"abc" |
No digits found. |
.
See Also: Method Syntax, JSONDATA Methods
![]() |