Fills a imListbox with the contents of a array-like JSON
string.
JSON is a lightweight data exchange format. It is described
at http://json.org. It is based on the
Javascript language.
The JSON methods used with ListSetJSON
operate on JSONItems as arrays
and cannot be mixed with JsonCreate
functions.
(The internal JSON
object is of Xojo type JSONItem [classic
Xojo framework])
Parameters:
Name |
Type |
Description |
ListboxName |
String |
ScreenFieldName
of the listbox to fill with contents. Ctrl+Click
onto a listbox to retrieve its ListboxName
(=
ScreenFieldName). |
contents |
String |
An
array like JSON string with contents to fill into a listbox. See ListGetJSON for
how to generate a Json string from the contents of a listbox. Example
JSON string: "[[""2015-05-18"",""PayPal"",""5.00""],[""2016-05-18"",""PayPal"",""15.00""]]" |
Available in:
WindowMain |
WindowLink |
YES |
YES |
Hint: You can
find references to XojoScripts which make use of this function by sending the
following SQL statement to the database:
Select id,GUID, ScriptName,ScriptCode from
im_scripts where ScriptCode Like '%ListSetJSON%'
Example XojoScript:
// Retrieve listbox data as a JSON string
Dim
jsn1 As String
= ListGetJSON("imLB_lnk_p01_PaymentList")
// Show json string
// For instance:
[["2015-05-18","PayPal","5.00"]]
MsgBox(jsn1)
// Fill a listbox from a array-like json string
// each row is enclosed in brackets
// columns are separated by commas
// the whole dataset is enclosed again with brackets
Dim
jsn2 As String
= "[[""2015-05-18"",""PayPal"",""5.00""],[""2016-05-18"",""PayPal"",""15.00""]]"
ListSetJSON("imLB_lnk_p01_PaymentList",jsn2)