Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Views and deleted records
Message
 
To
04/03/1999 15:23:25
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00194164
Message ID:
00194407
Views:
17
>Bret ---
>
>The answer to this question depends GREATLY on whether or not it's a local view or remote view and a number of other factors.
>
>Local view: If SET DELETED is OFF, you are right, a view returns deleted records from the source table with no indication that they are deleted. You could always add a logical flag to the base table to indicate deletion status and set this flag when a record is deleted. Then when you REQUERY() the view, do an automatic DELETE WHERE to the view based on that flag so that the records look and feel the old-fashioned deleted way (With SET DELETED OFF, of course)
>
>Remote view: Once a TABLEUPDATE() is issues, most server databases "disappear" the record and it's lost forever. The trick is to *not* update the back-end for deleted records until you're sure they will be deleted. How you implement this depends on the process you're following for UI and biz logic.
>
>
>>This may seem an easy question, but I would like to know this. I have an updateable view, the user lls up the record and deletes it. A save is done and then the view updates the main table. The main table reflects that the record is deleted. Now the user wishes to chnage their mind and recall the record, but when the view runs again the data is shown but there is no indication that this record (1 of 10 in the view) is deleted. Is there a way to have a view return records showing deleted and not deleted records.
>>
>>TIA

I tried your way John and I have a problem. I added a field called adndeleted (logical) to the local table and set it to .F. for all records. Now in my program when the user deletes a record, before the table update is performed the adndeleted gets set to .T.. I have looked at the local table and I have a deleted record with the flag adndeleted of true. Now when I go back into my form and call up that record, the form now does a check after the requery(adnview), that if the adndeleted flag is .T. then delete the record. Now the user is shown a deleted record and the recall button is enabled. I press the recall button, which recalls the record and sets the adndeleted flag to .F. Now I save the record (table update of the view). What happens is that there are now two records in my local table one original deleted and one new not deleted. The next time I try to call up the record I get a foxpro message that says the uniquness keys of this table have been violated, well of course they have as foxpro appended a new non deleted record with the same 2 keys as the one deleted. Any ideas?
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Previous
Reply
Map
View

Click here to load this message in the networking platform