Skip to content

DF_FILELIST_NAME

See Also: Get_Attribute, Set_Attribute

The name of the filelist file currently in use.

Level

Global

Type

String, temporary

Access

Read / Write

Values

The path (optional) and filename for a file list.

Remarks

This attribute may be used to dynamically change the name of the filelist in use. This allows your programs to open files from multiple filelists in the same session. The default filelist name used in DataFlex applications and all DataFlex tools is filelist.cfg.

The use of multiple filelists was needed in some applications in revisions of DataFlex prior to DataFlex 7 and revisions of character-mode DataFlex prior to DataFlex 3.2, because each filelist only supported 255 files. The DataFlex filelist now supports 4095 files, drastically reducing the need for multiple filelists. However, this attribute may still be required for maintaining and upgrading legacy applications.

Example Procedures

ShowFilelistName

Procedure ShowFilelistName
    String sName
    Get_Attribute DF_FILELIST_NAME To sName
    Showln "The current filelist name is: " sName
End_Procedure // ShowFilelistName

The sample procedure above shows the name of the file currently used as a filelist.

CreateNewFilelist

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 // NewEntry

Procedure CreateNewFilelist String sNewList
    Handle hoWorkspace
    String sPath
    Integer iMaxSlots

    //*** Make sure new filelist goes into the 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 // CreateNewFilelist

The sample procedure above creates a new, empty filelist and then sets the DF_FILELIST_NAME attribute to use that new filelist.