Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I revert edits on a newly appended buffered reco
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00564609
Message ID:
00565254
Views:
18
Hi!

For saving - yes, to copy fields from cursor into the orginal record(s).

For reverting - creating cusor and copying one or few records into it is a very quick process, so you do not need to maintain that cursor all the time - just create it only when needed (probably better to do this in the Load event of the child form). So reverting in your case will require to do nothing - just close that cursor at Destroy of the child form and the original data will be left unchanged.

HTH.

>Vlad... Using your last method I would be creating a cursor to keep a
>backup copy of the real record. What method would I use to copy the
>data from the cursor back to the original if the data was to be saved?
>A bunch of "replace origtable.field with cursor.field"?
>
>>Hi!
>>
>>This is not a good idea because when first call of chiled (that appended record) populated some field values by default values, oldval() will be already different, so when you try to do such kind of reverting in the second call of child form, the record will be put into a state just after the APPEND BLANK, not to state before the call of the second child form.
>>
>>I would recommende here to use another kind of working:
>>- use SCATTER/GATHER MEMVAR commands to read values into memory variables and bind form controls to these variables. When reverting, just do not store content of variables into table record. Thius have very huge disadvantage - requirement to use public variables or public object (when you use SCATTER/GATHER ... NAME).
>>- use COPY command to copy record content into the array that could be property of the form. When binding array elements to form controls you can easy lose self in indexes for that array (which index for which field?).
>>- use COPY command to copy record content into the temporary table than work with that table. Need to maintain that table.
>>- use "create cursor" command to create temporary cursor and then "append from" command to read one record into that cursor. This require to know a structure of the table, though you can easy copy it and use to recreate cursor with the same structure by using command "copy structure" or "afields()" function.
>>
>>See what is better for you.
>>
>>HTH.
>>
>>>Using VFP5...
>>>Parent and child are table buffered.
>>>
>>>In a child form I append a child record and then go back to the parent form.
>>>Then I go back to the child and change it. Still on the child I realize
>>>I want to revert to the original data but tablerevert would remove the record.
>>>So do I have to get OLDVAL() for each field and do a
>>>"replace field with OLDVAL('field','table')"?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform