|
zeiuszeppo Novice
Joined: 22 Nov 2001 Posts: 48 Location: Italy
|
Posted: Tue Feb 12, 2002 1:56 pm
use a DB |
I created a db with 3 field and a lot of records. Now I want to loop throught the
first field to match a string e getting
the second and third field of that record.
How can I do? |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Feb 12, 2002 6:19 pm |
You don't have to loop through the record, you can use the %find function and it returns a list of records that contain the specified string in the first field. You can loop through the returned list and use %dbget to retrieve that record and %db get the other fields. Example, suppose the database has three fields named: name, level, value
#FORALL %find("red") {#SH Level: %db(%dbget(%i), "level") Value: %db(%dbget(%i), "value")}
will find all of the records in the database that have the word "red" in the first field and display the contents of the field "level" and "value"
Kjata |
|
|
|
zeiuszeppo Novice
Joined: 22 Nov 2001 Posts: 48 Location: Italy
|
Posted: Tue Feb 12, 2002 11:13 pm |
how can i obtain the nth recond from a DB
using DBGET? |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Feb 12, 2002 11:54 pm |
%dbget(n)
Kjata |
|
|
|
zeiuszeppo Novice
Joined: 22 Nov 2001 Posts: 48 Location: Italy
|
Posted: Wed Feb 13, 2002 12:04 am |
I wirte this alias to load the db MobDispelScrap.db
#DBLOAD MobDispelScrap
#SH %db( %dbget( 1), "Key")
but the alias return me a clean line, but
the first record is full
Where is the error? |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Feb 13, 2002 1:09 pm |
Is the Database Module Window open?
Kjata |
|
|
|
zeiuszeppo Novice
Joined: 22 Nov 2001 Posts: 48 Location: Italy
|
|
|
|
|
|