Re: database.e record numbers & replace data
- Posted by Robert Craig <rds at ATTCANADA.NET> May 04, 2000
- 411 views
Tony Steward writes: > I am experimenting with the new database.e, > db_replace_data(i,x) does not seem to work > i keep getting an error expected to see expression > not procedure. db_replace_data() is a procedure, meaning it does not return a value. Only functions return values. Some of the database routines are functions, others are procedures. Many of the routines return an error code. db_replace_data() does not - it will call the fatal error handler if you pass it an invalid record number. > Also to delete a record you need the record number. > How do you get the rn and how can you move around by rn. You can get the record number from the key value for that record, by calling db_find_key(). If you don't know the key value, you will have to search for the record by starting at record number 1 and looping until the record number given by db_table_size(). e.g. recnum = 1 while recnum <= db_table_size() do data = db_record_data(recnum) if data[1] = 997 and equal(data[2], "Tony") then db_delete_record(recnum) end if recnum += 1 end while There are no routines such as "get next record" or "get previous record", since you can simply increment/decrement the record number to move to the next/previous record in a table. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com