|Subject:||Re: New fields to existing table
|Date:||Wed, 4 Apr 2018 11:48:45 +0100
|From:||Roger Phil <email@example.com>
Kevin I shall give that a try. Thanks very much
Kevin Zawicki wrote:
> Yes, I think you can use the restructure method....
> restructure uses a dynamic array named createSpec, which contains the information
> on the changes to make to the table.
> To specify the kind of change to be made, the field, index, referential integrity,
> and security structure tables, if specified, must include an ID field. This
> ID field is named slightly differently in each structure file, however, all
> end with id. Use this ID field to specify the type of operation to perform.
> The RestructureOperations constants RestructureModify, RestructureAdd, and
> RestructureDrop are provided for each operation.
> The following example appears in a script window and modifies the Customer
> table by changing a field name. This code uses enumFieldStruct to create
> the field structure information, updates the information, copies the updated
> information to a dynamic array and passes the dynamic array to the restructure
> method run(var eventInfo Event)
> tbl Table
> tcFlds TCursor
> dynNewStru DynArray Anytype
> tbl.attach( "Customer.db" )
> tbl.enumFieldStruct( "field_struct.db" )
> tcFlds.open("field_struct.db" )
> scan tcFlds :
> if tcFlds."Field Name" = "Name" then
> tcFlds."Field Name" = "Company Name"
> dynNewStru["FIELDSTRUCT"] = "field_struct.db"
> tbl.restructure( dynNewStru )
> Roger Phil <firstname.lastname@example.org> wrote:
>> Would anyone know if it's possible in opal to add extra fields to an
>> existing table without using enumfieldstruct to create a new table and
>> then adding records ?
>> This email has been checked for viruses by Avast antivirus software.