GetItemTime
PowerScript function
Syntax 1: GetItemTime ( ItemHandle )
Syntax 2: GetItemTime ( ParentItemHandle, Key )
Syntax 3: GetItemTime ( ItemPath )
Syntax 1
Description
Gets the value of the item whose type is time.
Applies to
Syntax
|
1 |
objectname.GetItemTime ( ItemHandle ) |
|
Argument |
Description |
|---|---|
|
objectname |
The name of the JSONParser object whose item value you |
|
ItemHandle |
A long whose value is the item handle of JsonStringItem |
Return value
Time.
Returns the time value of the item if it succeeds; if any
argument’s value is null, returns null; if an error occurs, the
SystemError event will be triggered.
Usage
If the item value is null, this function will throw an error,
therefore, it is recommended that before executing this function, call
GetItemType to check if the item
value is null. See example
2 in GetItemArray.
Examples
This example gets the value of the third item:
|
1 2 3 4 5 6 7 8 9 10 11 12 |
JsonParser lnv_JsonParser String ls_Json Time lt_time Long ll_RootObject, ll_item lnv_JsonParser = Create JsonParser ls_Json = '{"datetime":7234930293, "date": "2017-09-21", "time": "12:00:00"}' lnv_JsonParser.LoadString(ls_Json) ll_RootObject = lnv_JsonParser.GetRootItem() ll_item = lnv_JsonParser.GetChildItem(ll_RootObject, 3) lt_time = lnv_JsonParser.GetItemTime(ll_item) |
Syntax 2
Description
Gets the value of the item whose type is time.
Applies to
Syntax
|
1 |
objectname.GetItemTime ( ParentItemHandle, Key ) |
|
Argument |
Description |
|---|---|
|
objectname |
The name of the JSONParser object whose child item value |
|
ParentItemHandle |
A long whose value is the handle of the parent item of |
|
Key |
A string whose value is the key of the child item of |
Return value
Time.
Returns the time value of the child item if it succeeds; if any
argument’s value is null, returns null; if an error occurs, the
SystemError event will be triggered.
Usage
If the item value is null, this function will throw an error,
therefore, it is recommended that before executing this function, call
GetItemType to check if the item
value is null. See example
2 in GetItemArray.
Examples
This example gets the value of the “time” item:
|
1 2 3 4 5 6 7 8 9 10 11 |
JsonParser lnv_JsonParser String ls_Json Time lt_time Long ll_RootObject lnv_JsonParser = Create JsonParser ls_Json = '{"datetime":7234930293, "date": "2017-09-21", "time": "12:00:00"}' lnv_JsonParser.LoadString(ls_Json) ll_RootObject = lnv_JsonParser.GetRootItem() lt_time = lnv_JsonParser.GetItemTime(ll_RootObject, "time") |
Syntax 3
Description
Gets the value of the item whose type is time.
Applies to
Syntax
|
1 |
objectname.GetItemTime ( ItemPath ) |
|
Argument |
Description |
|---|---|
|
objectname |
The name of the JSONParser object whose item value you |
|
ItemPath |
A string whose value is the path of the item of |
Return value
Time.
Returns the time value of the item if it succeeds; if any
argument’s value is null, returns null; if an error occurs, the
SystemError event will be triggered.
Usage
If the item value is null, this function will throw an error,
therefore, it is recommended that before executing this function, call
GetItemType to check if the item
value is null. See example
2 in GetItemArray.
Examples
This example gets the value of the third item according to the
item path:
|
1 2 3 4 5 6 7 8 9 10 |
JsonParser lnv_JsonParser String ls_Json, ls_Path Time lt_time lnv_JsonParser = Create JsonParser ls_Json = '{"datetime":7234930293, "date": "2017-09-21", "time": "12:00:00"}' lnv_JsonParser.LoadString(ls_Json) ls_Path = "/time" lt_time = lnv_JsonParser.GetItemTime(ls_Path) |
See also