Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selective deletion of records in grid

Status
Not open for further replies.

dejanj

Programmer
Apr 22, 2002
25
0
0
AU
Dear All,

This seems to me as bug in VFP7. I am running VFP7 SP1 and my client wants to have ability to selectivly delete records from the grid.
Problem:
Client ( VFP7 ) is running remote view against VFP database ( VFP7 SP1)
I am running remote view with TABLEBUFFERING and multilocks ON.
My grid is read only and i made the property DeleteMark=.t. so the user can selectivly mark for deletion records and then by clicking on Delete button i just run TABLEUPDATE(.T.,.T.) and requery the remote VIew.

In my grid i display only up to 5 rows at the time because the height of the row is 70. SO user has to scroll up and down if they want to mark records for deletion. I noticed when i click on up/down scrollbar arrows the records i had marked for deletion start disapearing. My client certainly want like this "feature". Is there a fix for this or someother way of doing it.
I put the button to undo changes just run TABLEREVERT(.T.) but it is anoying and i have to find another solution.

I think i will have to come up with my using hidden field in my table instead relying on VFP7 delete mark.
Also i need to be able to count correctly of how many records have user marked for deletion.

Any idea is much appreciated?
How does one deal with selectivly deleting records from the grid ( readonly) in multiuser environment?


Thanks

Dejan
 
I like to add a new column of check boxes as the 1st column in the grid; where the user can tick which records they would like to delete.
In the right click method I add a menu where the user can tick all, untick all or tick rest.
Then when the user clicks on the delete menu option, the ticked records are deleted.

Shardlow.
 
Hi Mike,

Thank you very much for the tip.

Yes it works beautifully for remote views. I set on Init of the page
set dele on then
requery() then
set dele off

and in activate i have set dele off and grid behaves when i issue tableupdate(.t.,.t.) i requery() and the records are gone from the remote view.

...now i wanted to apply same principle in my local view in another form and when i issue requery() local view behaves like undo my marks for deletion records!!!

I am puzzled and i tested just in FOxpro command window when i run the view with set dele off and then mark the record for deletion and requery() the view records get unmarked. I checked wheather i maybe have Send SQL updates untick but it is ticked and the Local View is Updateable
Send SQL check box is ticked.
Can you enlighten me?
What is happening?

I made sure i have buffering to 5 but still doesn't work.
PLease help!!!

Thank you

Dejan
 
Dejan,

I am not clear from your description whether the records are being deleted from the underlying table, but the view is failing to see the deletes, or whether the deletes are not being sent in the first place.

Perhaps you could check to see if the records are in fact deleted from the underlying table. If they are not, it is probably because TABLEUPDATE() is not being called at the right time.

Mike


Mike Lewis
Edinburgh, Scotland
 
Mike,

Here is a test what i did:
I open the database in Foxpro, set dele off. Run the view
use wgsms!unrouted_lv and it returns 4 records
set buffering to 5 and then either issue DELETE to mark the record for deletion or just click on grid record marker.
Record(s) are marked for deletion then i issue tableupdate(.t.,.t.) and requery() the local view.
Result Local view got uncheked records ( like tablerevert() on view) but records for deletion where marked for the underlying table INSMS. I checked if my Local view is Send SQL tick and yes it is.

What next?

Thanks

Dejan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top