Skip to content

DF_FILE_ROOT_NAME

See Also: Get_Attribute, Set_Attribute

The table name (including an optional path) stored in the file list.

Level

Table

Supported by

All Drivers

Type

String, permanent

Access

Read / Write

Values

A string that points to a physical table.

Remarks

The root name can contain any characters that are legal in a table name on the operating system where the table is located and can be up to 40 characters long.

The root name of a database file is the name of the table, including an optional folder path. If the table is a non-Embedded Database table, driver_name and/or filename_suffix must be present. This is how DataFlex determines which database driver should handle the open request. The actual driver name and/or filename suffix that must be used with a particular database type is defined in the database-driver documentation.

If the filename suffix is .INT, then an intermediate file is being used. Many non-Embedded Database drivers support an intermediate file as a storage place for attributes that are not supported in the native database.

An intermediate file is an ASCII file that contains lines of keyword/value pairs that describe the attributes of the non-Embedded Database table. The first line in an intermediate file always contains the driver name and is used to determine which database driver should handle the open request.

Unlike other permanent table level attributes, the filelist attributes (DF_FILE_DISPLAY_NAME, DF_FILE_ROOT_NAME, and DF_FILE_LOGICAL_NAME) can be set outside of a Structure_Start ... Structure_End operation. These attributes are actually stored in the filelist and not in the database or table.

To add a table to an existing filelist, the three filelist attributes must be set at the same time. To remove a table from the filelist, the three filelist attributes must be set to an empty string.

Example Procedures

Show Filelist Names

Procedure ShowFilelistNames
    Handle hTable
    String sRoot sDisplay sTable
    Move 0 To hTable
    Repeat
        Get_Attribute DF_FILE_NEXT_USED Of hTable To hTable
        If (hTable <> 0) Begin
            Get_Attribute DF_FILE_ROOT_NAME Of hTable To sRoot
            Get_Attribute DF_FILE_DISPLAY_NAME Of hTable To sDisplay
            Get_Attribute DF_FILE_LOGICAL_NAME Of hTable To sTable
            Showln hTable ", " sRoot ", " sDisplay ", " sTable
        End
    Until (hTable = 0)
End_Procedure

The sample procedure above shows all the filelist attributes.

Create New Entry

Procedure NewEntry Handle hTable String sRoot String sDisplay String sTable
    Set_Attribute DF_FILE_ROOT_NAME Of hTable To sRoot
    Set_Attribute DF_FILE_DISPLAY_NAME Of hTable To sDisplay
    Set_Attribute DF_FILE_LOGICAL_NAME Of hTable To sTable
End_Procedure

The sample procedure above creates a new filelist entry at a given slot. It can also be used to remove a filelist entry by passing empty strings for the three filelist attributes.

Create New Filelist

Procedure CreateNewFilelist String sNewList
    Handle hoWorkspace
    String sPath
    Integer iMaxSlots

    //*** Make sure new filelist comes in first folder of datapath
    Get phoWorkspace Of ghoApplication To hoWorkspace
    Get psDataPath Of hoWorkspace To sPath
    Get PathAtIndex Of hoWorkspace sPath 1 To sPath
    If (Right(sPath, 1) <> Sysconf(Sysconf_Dir_Separator)) ;
        Move (sPath - Sysconf(Sysconf_Dir_Separator)) To sPath
    Move (sPath - sNewList) To sPath

    //*** Create the disk file
    Direct_Output sPath
    Write "filelist.cfg"
    Close_output

    //*** Use the disk file as filelist
    Set_attribute DF_FILELIST_NAME To sPath

    //*** Create all the slots
    Get_Attribute DF_NUMBER_FILES_SUPPORTED To iMaxSlots
    Send NewEntry iMaxSlots "" "" ""
End_Procedure

The sample procedure above uses the filelist attributes to create a new empty filelist. It calls the NewEntry procedure defined above.