ChangeTo command
Use in a Server.Load script to set the current database for the test.
Provide the full file name of the database (use server!!file if a remote database), or specify the keyword MAIL to open the mail database.
The
following statements operate on the specified database. If the database
doesn't exist, a new database is created using template [database
template name]. If the keepopen option is specified (which is the
string -keepopen
), the database is not closed and
reopened if it is already open.
Syntax
ChangeTo [database name] [database template name] [-keepopen]
Where:
- [database name] -- Full file name of the database
- [database template name] -- File name of the template database
- [-keepopen] -- Keeps the database open
Example 1
This example uses changeto to create a local database.
**Create local file using the journal template (journal.ntf)**
**NOTES.INI must
contain the setting templateversion=4
**
changeto journal.nsf journal[templateversion].ntf -KeepOpen
pause 5000
**Populate the view with 10 notes **
populate 10
pause 5000
**Open the view collection**
open
**Update the view index**
index
pause 5000
**Close the view collection**
close
Example 2
This example uses changeto to create multiple databases on a server. In this example the thread number is substituted in for the [#] symbol.
**Create one or more databases on a mail server using (journal.ntf)**
**NOTES.INI contains
the setting templateversion=4
**
**Creation of multiple databases, based on the number of threads**
**All test databases will be placed in the journal directory**
changeto [MailServer]!!journals\journal[#].nsf journal[templateversion].ntf -KeepOpen
pause 5000
**Populate the view with 10 documents**
populate 10
pause 5000
open
**Update the view index**
index
pause 5000
**Close the view collection**
close
Example 3
Create and initialize mail file(s)
**Script to create and initialize mail file(s)**
changeto [MailServer]!!mail\mail[#].nsf mail60.ntf
**Make sure there are enough notes in mail database**
populate [NumMailNotesPerUser] $Inbox
**Open the current view**
open
**Close the current view**
close
drop