Paradox Community

Items in pnews.paradox-programming

Subject:Re: New fields to existing table
Date:3 Apr 2018 23:44:47 -0400
From:"Kevin Zawicki" <>

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" )"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 <> 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.

Copyright © 2004