Prompt for data file

Command group Flag affected Reversible Execute on client Platform(s)
Data files YES NO NO All

Syntax

Prompt for data file ([Do not close other data][,Read-only][,No conversion by runtime][,Convert without user prompts][,Full Unicode conversion]) {[internal-name] or odb://[address:port][,internal-name]}

Options

Do not close other data If specified, the command does not close all open data files before opening the specified data file
Read-only If specified, the data file is opened in read-only mode
No conversion by runtime Omnis normally offers to convert data files created by an earlier version of Omnis. If this option is specified, the runtime version of Omnis will not offer to convert the file, and the command will fail
Convert without user prompts If specified, and conversion is allowed, Omnis will immediately perform the conversion without giving the user any prompts that require a response; also, the user cannot cancel the conversion
Full Unicode conversion Unicode Studio only. If specified, and convert without user prompts is specified, do full Unicode conversion instead of quick conversion (quick conversion is only ok when you know all character data in the file is 7 bit)

Description

This command prompts the user to enter the name of a data file. A dialog box is displayed that lets the user choose a data file. An error message e.g. "Unable to find data file" is generated if the selected file cannot be opened, and the user is forced to select another file name or Cancel. If the user selects Cancel, the flag is cleared and the original data file remains selected.

The selected file is opened in shared mode unless the volume does not support record locking.

The existing open data files remain open if the Do not close other data option is selected. In this case, the new data file becomes the "current" data file and this becomes the default data file for file classes which have not been associated with a particular data file using the Set default data file command. If the Do not close other data option is not specified, all other open data files are closed even if the command fails.

If an attempt is made to open a data file which is already open, that data file is closed and reopened. The Read-only Studio/Omnis 7 check box causes the data file to be opened in read-only mode. This lets you open an Omnis 7 data file in read-only mode in Omnis Studio without conversion taking place.

If you select the No conversion by runtime option, and the data file was created with a previous version of Omnis, then the runtime version of Omnis will not convert the data file. The default is that an Omnis runtime will ask the user if they want to convert the data file.

If the data file is to be accessed using the ODB (Omnis Data Bridge), then you indicate this using a special syntax:

odb://[address:port]

where address:port is the TCP/IP address and port number of the ODB server, e.g. 127.0.0.1:5900. Omnis opens a dialog that allows you to select a data file handled by the ODB server. You can omit address:port, in which case Omnis uses the address and port stored in the $odbserver root preference. Note that the value of $odbserver is stored in the file odb.txt in the studio folder of the Omnis installation tree.

Example

Test if file exists {Orders.df1}
If flag true
  Open data file {Orders.df1}
Else
  Prompt for data file
  If flag false
    Quit method
  End If
End If

# Example 2 - Prompt for a data file on a specific ODB server
Prompt for data file {odb://127.0.0.1:5900}
# Example 3 - Prompt for a data file using the ODB server identified by $prefs.$odbserver
Prompt for data file {odb://}