ars_CreateField(ctrl, schema, fieldHash, reservedIdOK=0 )

This function creates a new field. You must first populate the fieldHash before calling this routine.

schema is the name of the schema where the field is to be created.

fieldHash is a Field Properties Structure hash.

reservedIdOK must be set to 1 if you want to create a field in the reserved field id range (i.e. <= 536870912).

On success
Returns 1
On failure
Returns 0

Example:

This example copies an existing field to a new field. I.e. it simply re-saves the field under a new name.
      ($fd = ars_GetField($c, "Schema", 536870913)) ||
	    die $ars_errstr;
      $fd->{fieldId}   = $fd->{fieldId} + 100000;
      $fd->{fieldName} = "Copy of ".$fd->{fieldName};
      ars_CreateField( $c, "Schema", $fd ) || die $ars_errstr;
      
Notes: Hash keys helpText, owner and changeDiary are optional when calling this routine. fieldId can be specified as 0 if you want the the server to generate a field id.

This function was introduced in version 1.90 of ARSperl

<-- Back to Table of Contents