 |
KiraDouji Newbie
Joined: 03 Jan 2004 Posts: 6
|
Posted: Tue May 25, 2004 2:22 pm
Manipulating Databases (Help) |
Okay, I have a healing database with only two fields: Afflicted and Cure. Afflicted is a boolean and Cure is text in which the content is actually an alias.
Row 0 has Afflicted set to F (or 0) and Cure to "wormwood". Wormwood is an alias whose value is "outr wormwood; eat wormwood". So all I want to do is step through the records, checking the "Afflicted" field for T, and if it's true, then excute the "Cure" field.
However, no matter how much troubleshooting I do I just can't get the value of "Afflicted" or "Cure". I've probably read through these help files for at least three hours now and tried every way of accessing these values but for some reason it just won't work. So if anyone could clear up database usage this basic that it hurts not understanding it, I'd really appreciate it.
- Kira |
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue May 25, 2004 6:06 pm |
Open the database window if it's not already open. Select your healing database as the current database and All as the view. Return to the main window. Don't close the database window.
Type this in:
#LOOPVIEW {#SHOWDB %rec}
That should show you all your existing records.
To loop through the database and perform the "Cure" for each "Afflicted", something like this should work
#LOOPVIEW {#IF (&Afflicted) {#EXEC &Cure}}
Of course, if &Afflicted is 0 nothing will happen.
#LOOPVIEW is likely to be too fast. To step through the database one record at a time, you can use #DBFIRST to set the database to the first record in the view and #DBNEXT to advance it after each item is checked. When you pass the final record in the view, #DBNEXT will set %rec to a null value and you can use that stop when you reach the end. You would then do something like this for each record.
#IF (%rec) {#IF (&Afflicted) {#EXEC &Cure};#DBNEXT} {#SAY Cures completed} |
|
|
|
 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|