 |
MikkoM Newbie
Joined: 04 Jan 2004 Posts: 1 Location: Finland
|
Posted: Mon Jan 05, 2004 2:33 am
Using databases in scripts |
A simple question, but I was unable to find the answer by search the forum posts...
Is there a way to access databases from within a script (e.g. a trigger) without opening the database window first? I've tried, but none of the database commands do anything unless the DB window is open. |
|
|
 |
Danlo Magician

Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Mon Jan 05, 2004 7:35 am |
Indeed you can:
#dbload <first-two-letters-of-the-database-you-want-to-open>
#dbclose <first-two-letters-of-the-database-you-want-to-open>
#dbsave <name of the database>
To access records inside current database:
%db(rec,key)
Where rec is the database record you want to access, and key is the field you want the value from.
#DBPUT saves new data to an existing database record. Usage:
#DBPUT RecordNum {Name1=Value1|Name2=Value2|...}
For more detailed explanations and more commands, check help on Programming the Database |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Jan 05, 2004 11:24 am |
No, you can't access the databases from within a script without opening the database window. The database module is only loaded when the database window is open. This module contains most of the database related commands, including #DBLOAD.
However, you can open the database window by script using the #MENU command.
#MENU {Windows|Database} |
|
|
 |
|
|