SET JSONBOOLEAN

From Lianjapedia
Jump to: navigation, search

Purpose

To return true | false, instead of "Yes" | "No" for booleans/logicals in desktop ODATA_READ() queries

Syntax

SET JSONBOOLEAN ON | OFF

See Also

APPEND BLANK, APPEND FROM, APPEND FROM ARRAY, DELETE (NoSQL), DELETE (SQL), INSERT, JSON_DECODE(), JSON_DECODE_FILE(), JSON_ENCODE(), OData Operators, OData URIs, ODATA_CREATE(), ODATA_DELETE(), ODATA_READ(), ODATA_UPDATE(), PRINT_JSON(), SELECT, UPDATE

Description

The SET JSONBOOLEAN command is used to determine the values returned for booleans/logicals in desktop ODATA_READ() queries. By default, SET JSONBOOLEAN is OFF and ODATA_READ() returns "Yes" | "No". If SET JSONBOOLEAN is ON, ODATA_READ() returns true | false.

Example

close data
odata_read("/southwind/products?$select=discontinued&$top=5")
set jsonboolean on
odata_read("/southwind/products?$select=discontinued&$top=5")
set jsonboolean off
{"d" : {
	"results": [
		{"discontinued":"Yes"},
		{"discontinued":"No"},
		{"discontinued":"Yes"},
		{"discontinued":"No"},
		{"discontinued":"No"}
	],
	"__database": "southwind",
	"__table": "products",
	"__primarykey": "",
	"__tabletype": "table",
	"__datatypes": "L",
	"__href": "/odata/southwind/products?$select=discontinued&$top=5",
	"__querytime": "6ms",
	"__count": 77,
	"__reccount": 5,
	"__page": 0
}}
{"d" : {
	"results": [
		{"discontinued":true},
		{"discontinued":false},
		{"discontinued":true},
		{"discontinued":false},
		{"discontinued":false}
	],
	"__database": "southwind",
	"__table": "products",
	"__primarykey": "",
	"__tabletype": "table",
	"__datatypes": "L",
	"__href": "/odata/southwind/products?$select=discontinued&$top=5",
	"__querytime": "5ms",
	"__count": 77,
	"__reccount": 5,
	"__page": 0
}}