From: Alex Ricks <[email protected]>
Huhmmn, How to explain this?
I need some help with these "psuedo" arrays. I can create a numbered array based on
dbase three record numbers, but I have trouble retrieving the data from these arrays,
assigning them to the dbase record fields and updating the record :
I am currently working on a project where data stored in a dbase III table is opened and
queried with mvfind. The results are display in a form and table, one record per row
by way of a mvwhile loop. Three of the fields for each record can be changed by the
user and updated when the form is submitted.
The default data for the form text boxes is the value retrieved from the matching field
of the dbase III table. After the user changes the data in the text boxes and submits the form, the
data is passed to the program in numbered arrays cooresponding to it's dbase record
number (alias_db.d.recno). This works fine until I try to retrieve the data ie.:
Here is the table :
recno type name size qty delete id
-------- -------- -------- -------- ------- -------- --------
1 border floral yard 3 n O1BE8CD406
2 print pastel memo 2 n O1BE8CD406
3 border stripes yard 4 y O1BE8CD406
Only columns 4,5,6 (size, qty, delete) can be edited by the user with form fields .
After changing the data and submitting the form, the command line array looks like this :
documenturl.mv?size_3=yard&size_2=memo&size_1=yard &qty_3=4&qty_2=2&qty_1=3&
delete_3=y&delete_2=n&delete_1=n&session_id=O1BE8C D406B78B4&screen=update
The variable "screen" directs the program to a function called "update". The
"session_id" number is used for tracking purposes and to retrieve the dbase III records
with mvfind. I want to open the database, mvfind the records matching that id #, and
update the record with the "array" variables that correspond to the database record
number. Then I loop the process with an mvwhile until all of the records have been
updated. Here is my code. I replace the '>' with '*' so this message board doesn't cut
out my code :
* MVFUNCTION NAME="update" *
* MVOPEN NAME="orderform_db" DATABASE="orderform.dbf" *
* MVMAKEINDEX NAME="orderform_db" INDEXFILE="orderform_session_id.mvx" *
EXPR="{orderform_db.d.session_id}" FLAGS="descending" *
* MVFIND NAME="orderform_db" VALUE="{&[g.session_id]}" *
* MVWHILE EXPR="{NOT orderform_db.d.eof AND orderform_db.d.session_id EQ g.session_id}" *
* MVASSIGN NAME="orderform_db.d.size" VALUE="size_&[orderform_db.d.recno]" *
* MVASSIGN NAME="orderform_db.d.qty" VALUE="qty_&[orderform_db.d.recno]" *
* MVASSIGN NAME="orderform_db.d.deleted" VALUE="delete_&[orderform_db.d.recno]" *
* MVUPDATE *
* MVSKIP *
* /MVWHILE *
* MVCLOSE NAME="orderform_db" *
* /MVFUNCTION *
My problem occurs with the three mvassigns you see. I am trying to assign the value
from the arrays to the database fields by calling the array with it's name appended by the
record number of the current open record (size_1, qty_1, delete_1 . . .etc). No matter
how I change the syntax after (value=" "), it either doesn't work or gives me a syntax error.
I know that the dbase III thing with Miva is new and advise is scarce, but if anyone can
help me join these variables names to call the arrays, I'll give them the source code for
the entire application. It will permit you to open and edit multiple database records from
multiple tables at once instead of one record at a time like you see on most miva
applications currently passed around on the web.
Thanks,
Alex Ricks
mailto:[email protected]
Comment