Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

GetItemType – PB Docs 2021 – PowerBuilder Library

GetItemType – PB Docs 2021

GetItemType

PowerScript function

Description

Gets the type of the item.

Applies to

JSONParser and JSONPackage

Syntax for JSONParser

Syntax for JSONPackage

Argument

Description

objectname

The name of the JSONParser or JSONPackage object whose
item type you want to obtain.

ItemHandle

A long whose value is the item handle.

ParentItemHandle

A long specifying the parent item handle which is
JsonObjectItem type.

ItemPath

A string specifying the item path. If there is a
multi-dimensional array, use the number to indicate the order of
the array elements. If a key name contains “/”, use the escape
character “~~/” to replace “/”.

Key

A string specifying the key of the child item.

Return value

JsonItemType.

Returns the JsonItemType enumerated value if it succeeds and null
value if an error occurs. If any argument’s value is null, the method
returns null.

The JsonItemType enumerated values are:

  • JsonStringItem! — Type of the JSON node whose key value pair is
    a string, such as “name”:”evan”.

  • JsonNumberItem! — Type of the JSON node whose key value pair is
    a number, such as “id”:1001.

  • JsonBooleanItem! — Type of the JSON node whose key value pair
    is a boolean, such as “active”:true.

  • JsonNullItem! — Type of the JSON node whose key value pair is
    null, such as “remark”: null.

  • JsonObjectItem! — Type of the JSON node whose key value pair is
    an object, such as “date_object”:{“datetime”:7234930293, “date”:
    “2017-09-21”, “time”: “12:00:00”}.

  • JsonArrayItem! — Type of the JSON node whose key value pair is
    an array, such as “department_array”:[999999, {“name”:”Website”},
    {“name”:”PowerBuilder”}, {“name”:”IT”}].

Example 1

This example gets the key value and type of the child items
according to the item handle in a loop:

Example 2

This example gets the key value and type of the child items
according to the parent item handle in a recursive traversal:

Example 3

This example gets the key value and data type of the child items
according to the item path:

Example 4

This example gets the data type of the child items according to the
specified index and then gets the key value according to the type:

Example 5

This example loads a JSON string to a JSONParser object and gets and
processes the value according to the type.

See also

GetItemArray

GetItemArrayJSONString

GetItemBlob

GetItemBoolean

GetItemByPath

GetItemDate

GetItemDateTime

GetItemNumber

GetItemObject

GetItemObjectJSONString

GetItemString

GetItemTime

GetNumberType


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x