@DbExists (Formula Language)

Given a server and file name, or replica ID, indicates whether the specified database exists.

Syntax

@DbExists( server : file )

@DbExists( server ; replicaID )

Parameters

server

Text. The name of the server. Use an empty string ("") to indicate the local computer.

file

Text. The path and file name of the database. Specify the database path and file name using the appropriate format for the operating system.

replicationID

Text. The replica ID of the database.

Return value

flag

Number.

  • Returns 1 (True) if the database exists.
  • Returns 0 (False) if it does not exist.

Usage

This function does not work in column or selection formulas, or in agents that run on a server (mail and scheduled agents).

Examples

  1. This formula returns 1 if FRITES.NSF is in the MAIL directory on the server Belgium. Otherwise it returns 0.
    @DbExists( "Belgium" : "mail\\frites.nsf" )
  2. This formula checks if a database exists before opening it on the workspace.
    server := @Subset( @MailDbName; 1 );
    file := "mail\\blah.nsf";
    @If( @DbExists( server : file ) ; @PostedCommand([FileOpenDatabase]; server : file ); @Prompt([OK]; "Sorry"; "The database cannot be located on your home server." ) )
  3. This formula uses a database's replica ID instead of its file name:
    Exists := @DbExists("Cheshire";"852556DO:00576146");