4D v14.3

OB GET PROPERTY NAMES

Home

 
4D v14.3
OB GET PROPERTY NAMES

OB GET PROPERTY NAMES 


 

OB GET PROPERTY NAMES ( object ; arrProperties {; arrTypes} ) 
Parameter Type   Description
object  Object in Structured object
arrProperties  Text array in Property names
arrTypes  Longint array in 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.

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 JSON null Longint 255
Is object Longint 38
Is real Longint 1
Is string var Longint 24
Is text Longint 2
Is undefined Longint 5
Object array Longint 39

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)
 APPEND TO ARRAY($arrayChildren;$ref_susan)
 OB SET($ref_james;"name";"James";"age";3)
 APPEND TO ARRAY($arrayChildren;$ref_james)
 
 OB GET PROPERTY NAMES($arrayChildren{1};$arrNames;$arrTypes)

 
PROPERTIES 

Product: 4D
Theme: Objects (Language)
Number: 1232

 
HISTORY 

New
Created: 4D v14

 
SEE ALSO 

OB Get type

 
ARTICLE USAGE

4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)