This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
OB GET PROPERTY NAMES
|
OB GET PROPERTY NAMES ( object ; arrProperties {; arrTypes} ) | ||||||||
Parameter | Type | Description | ||||||
object | Object |
![]() |
Structured object | |||||
arrProperties | Text array |
![]() |
Property names | |||||
arrTypes | Longint array |
![]() |
Property types | |||||
The OB GET PROPERTY NAMES command returns, in arrProperties, the names of the properties contained in the language object designated by the object parameter.
object must have been defined using the C_OBJECT command or designate a 4D object field.
Pass a text array in the arrProperties parameter. If the array does not exist, the command creates and sizes it automatically.
Optionally, you can also pass a longint array in arrTypes. For each element of arrProperties, the command returns, in arrTypes, the type of value stored in the property. You can compare the values received with the following constants, found in the "Field and Variable Types" theme:
Constant | Type | Value |
Is Boolean | Longint | 6 |
Is collection | Longint | 42 |
Is null | Longint | 255 |
Is object | Longint | 38 |
Is real | Longint | 1 |
Is text | Longint | 2 |
Object array | Longint | 39 |
Note: For array attributes, the command returns Is collection.
You want to test that an object is not empty:
ARRAY TEXT(arrNames;0)
ARRAY LONGINT(arrTypes;0)
C_OBJECT($ref_richard)
OB SET($ref_richard;"name";"Richard";"age";7)
OB GET PROPERTY NAMES($ref_richard;arrNames;arrTypes)
// arrNames{1}="name", arrNames{2}="age"
// arrTypes{1}=2, arrTypes{2}=1
If(Size of array(arrNames)#0)
// ...
End if
Using an object array element:
C_OBJECT($Children;$ref_richard;$ref_susan;$ref_james)
ARRAY OBJECT($arrayChildren;0)
OB SET($ref_richard;"name";"Richard";"age";7)
APPEND TO ARRAY($arrayChildren;$ref_richard)
OB SET($ref_susan;"name";"Susan";"age";4;"girl";True) //additional attribute
APPEND TO ARRAY($arrayChildren;$ref_susan)
OB SET($ref_james;"name";"James")
OB SET NULL($ref_james;"age") //null attribute
APPEND TO ARRAY($arrayChildren;$ref_james)
OB GET PROPERTY NAMES($arrayChildren{1};$arrNames;$arrTypes)
// $arrayChildren{1} = {"name":"Richard","age":7}
// $arrNames{1}="name"
// $arrNames{2}="age"
// $arrTypes{1}=2
// $arrTypes{2}=1
OB GET PROPERTY NAMES($arrayChildren{2};$arrNames;$arrTypes)
// $arrayChildren{3} = {"name":"Susan","age":4,"girl":true}
// $arrNames{1}="name"
// $arrNames{2}="age"
// $arrNames{3}="girl"
// $arrTypes{1}=2
// $arrTypes{2}=1
// $arrTypes{3}=6
OB GET PROPERTY NAMES($arrayChildren{3};$arrNames;$arrTypes)
// $arrayChildren{3} = {"name":"James","age":null}
// $arrNames{1}="name"
// $arrNames{2}="age"
// $arrTypes{1}=2
// $arrTypes{2}=255
Product: 4D
Theme: Objects (Language)
Number:
1232
Created: 4D v14
Modified: 4D v15
Modified: 4D v16 R4
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)