Discussion:
do - until ... help
(too old to reply)
Ivan Benttini
2008-11-17 20:53:34 UTC
Permalink
Dear people!
How do I check if a rowset has been flaged for deletion,
since my goal is to recall it (undelete) and bring it back
to be live again. I appriciate any help.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
set deleted OFF
form.NA1.rowset.first()
?"test First Rowset-first name
:",form.NA1.rowset.fields["fname"].value
wait
do
// here I want to check if a rowset is flaged for deletion
// before recall it tp live again, but instead I keep deleting
// the whole test table with out any error message.
if form.NA1.rowset.delete() .
recall
else
endif
until form.NA1.rowset.endOfSet
set deleted ON
//////////////////////////////////////////////////////////////////////////////////////////////////////
Ivan
Marc Hamelin
2008-11-17 21:04:21 UTC
Permalink
Here's how I would do it, because I don't think you can do it using OODML,
like you are trying to do:

// Use a table with an index
use TABLE.DBF order FIELDKEY

// Set the deleted rows as visible
set deleted off

do
// Undelete the row if found and tagged as deleted
if deleted() == true
recall
skip 1
else
skip 1
endif
until eof() == true

// Set the deleted rows as invisible again
set deleted on

// Close the table(s) in use
close tables

Hope this helps.

Marc Hamelin
Ivan Benttini
2008-11-19 19:09:28 UTC
Permalink
Marc,
It did, and I am gratefull.
Ivan
Post by Marc Hamelin
Here's how I would do it, because I don't think you can do it using OODML,
// Use a table with an index
use TABLE.DBF order FIELDKEY
// Set the deleted rows as visible
set deleted off
do
// Undelete the row if found and tagged as deleted
if deleted() == true
recall
skip 1
else
skip 1
endif
until eof() == true
// Set the deleted rows as invisible again
set deleted on
// Close the table(s) in use
close tables
Hope this helps.
Marc Hamelin
Ivan Benttini
2008-11-17 23:20:42 UTC
Permalink
Thank you Marc and Mervyn,
Everybody is happy here now, specially my cat (paco)
since now that everything is working, thanks to you all's help
I can take him out around the building to see the girls coming to
the 3rd shift. (smile)
(*!&^%_+":|* .... that is ThankYou in cat's Language
Ivan
Post by Ivan Benttini
Dear people!
How do I check if a rowset has been flaged for deletion,
since my goal is to recall it (undelete) and bring it back
to be live again. I appriciate any help.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
set deleted OFF
form.NA1.rowset.first()
?"test First Rowset-first name
:",form.NA1.rowset.fields["fname"].value
wait
do
// here I want to check if a rowset is flaged for deletion
// before recall it tp live again, but instead I keep deleting
// the whole test table with out any error message.
if form.NA1.rowset.delete() .
recall
else
endif
until form.NA1.rowset.endOfSet
set deleted ON
//////////////////////////////////////////////////////////////////////////////////////////////////////
Ivan
Mervyn Bick
2008-11-17 21:12:11 UTC
Permalink
Post by Ivan Benttini
Dear people!
How do I check if a rowset has been flaged for deletion,
since my goal is to recall it (undelete) and bring it back
to be live again. I appriciate any help.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
set deleted OFF
form.NA1.rowset.first()
?"test First Rowset-first name
:",form.NA1.rowset.fields["fname"].value
wait
do
// here I want to check if a rowset is flaged for deletion
// before recall it tp live again, but instead I keep deleting
// the whole test table with out any error message.
if form.NA1.rowset.delete() .
recall
else
endif
until form.NA1.rowset.endOfSet
set deleted ON
The new OODML does not know about undeleting records. In virtually every
other database manager except dBase, once a record is deleted it is gone
forever and dBase has moved in that direction. It is, however, possible
to use the old DML commands to undelete records in .dbf tables.


The following is untested.

USE <filename>
set deleted off
recall all deleted()
set deleted on

If it doesn't work try

USE <filename>
set deleted off
do while not eof()
if deleted()
recall
endif
skip
enddo

Mervyn.
Marilyn Price
2008-11-18 14:17:36 UTC
Permalink
In article <***@mervynb>, "Mervyn Bick"
<invalid.invalid.invalid> says...
Post by Mervyn Bick
The following is untested.
USE <filename>
set deleted off
recall all deleted()
recall all
or
recall for deleted()

You either need the keyword "for" before deleted() or drop the function
completely.

Recall only affects records marked for deletion, so there's no need to
use the for deleted() clause at all.
--
Marilyn Price
M. P. Data
Mervyn Bick
2008-11-18 15:14:49 UTC
Permalink
Post by Mervyn Bick
recall all
or
recall for deleted()
You either need the keyword "for" before deleted() or drop the function
completely.
Recall only affects records marked for deletion, so there's no need to
use the for deleted() clause at all.
Thanks for putting that straight. It's been a LONG time since I used that
and the memory isn't what it was. <g> I didn't have time to try it out
which is why the caveat "untested" was there.

I've adopted the strategy of putting untested code, usually suitably
marked as such, in the body of a message. If I've actually tried the code
I copy and paste it as an example below my signature.

Mervyn.
Marilyn Price
2008-11-19 13:10:26 UTC
Permalink
In article <***@mervynb>, "Mervyn Bick"
<invalid.invalid.invalid> says...
Post by Mervyn Bick
Post by Mervyn Bick
recall all
or
recall for deleted()
You either need the keyword "for" before deleted() or drop the function
completely.
Recall only affects records marked for deletion, so there's no need to
use the for deleted() clause at all.
Thanks for putting that straight. It's been a LONG time since I used that
and the memory isn't what it was. <g> I didn't have time to try it out
which is why the caveat "untested" was there.
Yup. I understand.
Post by Mervyn Bick
I've adopted the strategy of putting untested code, usually suitably
marked as such, in the body of a message. If I've actually tried the code
I copy and paste it as an example below my signature.
Good strategy!
--
Marilyn Price
M. P. Data
Ivan Benttini
2008-11-19 19:12:32 UTC
Permalink
Thanks Marilyn and Mervyn,
Ivan
Post by Marilyn Price
<invalid.invalid.invalid> says...
Post by Mervyn Bick
Post by Mervyn Bick
recall all
or
recall for deleted()
You either need the keyword "for" before deleted() or drop the function
completely.
Recall only affects records marked for deletion, so there's no need to
use the for deleted() clause at all.
Thanks for putting that straight. It's been a LONG time since I used that
and the memory isn't what it was. <g> I didn't have time to try it out
which is why the caveat "untested" was there.
Yup. I understand.
Post by Mervyn Bick
I've adopted the strategy of putting untested code, usually suitably
marked as such, in the body of a message. If I've actually tried the code
I copy and paste it as an example below my signature.
Good strategy!
--
Marilyn Price
M. P. Data
Geoff Wass [dBVIPS]
2008-11-19 06:14:12 UTC
Permalink
Post by Ivan Benttini
Dear people!
How do I check if a rowset has been flaged for deletion,
since my goal is to recall it (undelete) and bring it back
to be live again. I appriciate any help.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Ivan,

Just so you know, "undeleting" is not a good habit to get into. dBASE
left it out of OOP for a reason - as Mervyn said, no one else does it.
If you don't want something to be deleted, then don't delete it. Set a
flag, if you need to distiguish from all the other rows in the table.
This will let you develop a program that can more easily migrate to
other database systems. It reduces the risk of mixing up "I only wanted
it deleted for a little while" from the "I wanted to delete the thing
forever and ever". If you PACK or modify the structure of the table,
both of these "deleted" rows are going to be gone forever.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Ivan Benttini
2008-11-19 19:06:57 UTC
Permalink
Thanks you all for the assistance, another lesson toughed
of database manipulation to me, by you all.
Mille gracie (Thank You)
Ivan
Post by Geoff Wass [dBVIPS]
Post by Ivan Benttini
Dear people!
How do I check if a rowset has been flaged for deletion,
since my goal is to recall it (undelete) and bring it back
to be live again. I appriciate any help.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Ivan,
Just so you know, "undeleting" is not a good habit to get into. dBASE
left it out of OOP for a reason - as Mervyn said, no one else does it.
If you don't want something to be deleted, then don't delete it. Set a
flag, if you need to distiguish from all the other rows in the table.
This will let you develop a program that can more easily migrate to
other database systems. It reduces the risk of mixing up "I only wanted
it deleted for a little while" from the "I wanted to delete the thing
forever and ever". If you PACK or modify the structure of the table,
both of these "deleted" rows are going to be gone forever.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada
.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Geoff Wass [dBVIPS]
2008-11-22 06:59:30 UTC
Permalink
Post by Ivan Benttini
Thanks you all for the assistance, another lesson toughed
of database manipulation to me, by you all.
Mille gracie (Thank You)
Ivan
Ivan,

You're welcome.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Loading...