Changing structures


<< Click to Display Table of Contents >>

Navigation:  Getting Started >


Changing structures


Previous pageReturn to chapter overviewNext page


Some applications use variable record structures for the same file. VO2Btrieve also has a mechanism to handle these kind of files

You first open the file with a structure that will be the default structure, and later tell VO2Btrieve what alternative structure(s) you want to use with the file.

Defining an alternative structure will not influence the segments that are used for the indexes of the open file.


For example:


The default definition of a file may contain the following fields:

ZIP        Char        9        Index 1

Name        Char        10        Index 2


The alternative definition of the file may contain the following fields:

ZIP4        Char        4            Used in Index 1

ZIP5        Char        5        Used in Index 1

Name        Char        10        Index 2


After switching to the second layout the first index will still have ONE SEGMENT OF SIZE 9. The first 4 characters in the segment will be from the field ZIP4, the second 5 characters will be from the field ZIP5.


If you have opened a file based on a DDF dictionary, you can use the Bt_ReadDDFieldInfo function to read the alternative layout from the DDF Dictionary, and pass the information returned by that function to the AddStruct() method.



You should be VERY CAREFUL when using this if you have used the server in combination with VO's DataWindow and/or Databrowser classes.

The DataWindow and Databrowser classes store information about the server they are connected to internally, and they may get confused by the new structure, especially if they are linked to a field that is not available anymore in the new structure.


If you have to switch to another layout for a server that is in use by a window or a browser, you better disable notification before you do so and until you are finished








oSrvr := BtDDFServer.....

aFlds                := Bt_ReadDDFieldInfo(....)





// now operate on the alternative layout                

// to be safe we disable notifications


symStruct                := oSrv:CurrStruct




// Switch back to the previous layout

// and enable notifications







See Also



BtTable:AddStruct(), BtServer:AddStruct(), BtTable:SetStruct(), BtServer:SetStruct(), Bt_ReadDDFieldInfo()