| 4D v18ARRAY TO COLLECTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
    4D v18
 ARRAY TO COLLECTION 
         | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ARRAY TO COLLECTION ( collection ; tableau {; nomPropriété}{; tableau2 ; nomPropriété2 ; ... ; tableauN ; nomPropriétéN} ) | ||||||||
| Paramètre | Type | Description | ||||||
| collection | Collection |   | Collection qui reçoit les données du tableau | |||||
| tableau | Tableau |   | Tableau à copier vers la collection ; si le paramètre nomPropriété est passé, sont copiées les valeurs correspondantes à la propriété dans la collection | |||||
| nomPropriété | Texte |   | Nom de propriété Objet dont les valeurs remplissent les éléments du tableau | |||||
La commande ARRAY TO COLLECTION copie un ou plusieurs tableau(x) dans les éléments ou les valeurs nomPropriété de collection.
Cette commande peut être utilisée avec une collection qui contient des valeurs ou une collection qui contient des objets, dans ce cas le(s) paramètre(s) nomPropriété est (sont) obligatoire(s).
Vous souhaitez copier un tableau texte dans une collection :
 C_COLLECTION($colFruits)
 $colFruits:=New collection
 ARRAY TEXT($artFruits;4)
 $artFruits{1}:="Orange"
 $artFruits{2}:="Banana"
 $artFruits{3}:="Apple"
 $artFruits{4}:="Grape"
 ARRAY TO COLLECTION($colFruits;$artFruits)
  //$colFruits[0]="Orange"
  //$colFruits[1]="Banana"
  //...Vous souhaitez copier les valeurs de champs dans une collection d'objets via des tableaux :
 C_COLLECTION($col)
 $col:=New collection
 ARRAY TEXT($artCity;0)
 ARRAY LONGINT($arLZipCode;0)
 SELECTION TO ARRAY([Customer]City;$artCity)
 SELECTION TO ARRAY([Customer]Zipcode;$arLZipCode)
 ARRAY TO COLLECTION($col;$artCity;"cityName";$arLZipCode;"Zip")
  //$col[0]={"cityName":"Cleveland","Zip":35049}
  //$col[1]={"cityName":"Blountsville","Zip":35031}
  //...Vous souhaiter copier un tableau texte dans une collection partagée :
 ARRAY TEXT($at;1)
 
 APPEND TO ARRAY($at;"Apple")
 APPEND TO ARRAY($at;"Orange")
 APPEND TO ARRAY($at;"Grape")
 
 C_COLLECTION($sharedCol)
 $sharedCol:=New shared collection
 
 Use($sharedCol)
    ARRAY TO COLLECTION($sharedCol;$at)
 End use
									COLLECTION TO ARRAY
									
									Conversions de type entre les collections et les tableaux 4D
									
	Produit :  4D
	Thème :  Collections
	Numéro :  
        1563
        
        
        
	
	Créé :  4D v16 R6
	
	
	
	
	
	
	
	
	
	4D - Langage ( 4D v18)
	
	
	
	
	
 Ajouter un commentaire
Ajouter un commentaire