Page 1 of 1

View deleted records in xBrowse

PostPosted: Tue Dec 13, 2022 8:14 pm
by TimStone
For all of my application, I have SET DELETED ON so I do not display deleted records.

HOWEVER, in one program, I do want to use xBrowse to see ALL records.

Is there a flag for xBrowse that will allow me to view ALL records, including the deleted records, for just that file ?

I have tried the command line to SET DELETED OFF but that isn't working.

Re: View deleted records in xBrowse

PostPosted: Tue Dec 13, 2022 9:23 pm
by Marc Venken
Maybe if you would make or have a index on for deleted on that file you can use this :

Here : http://forums.fivetechsupport.com/viewtopic.php?f=3&t=38884&hilit=xbrowse+deleted&sid=a137e6519929be708f84654075ade8a8

Re: View deleted records in xBrowse

PostPosted: Tue Dec 13, 2022 9:27 pm
by Antonio Linares
Dear Tim,

I just tested FWH\samples\fivedbu.prg and changed this line:

SET DELETED ON // OFF

and then I did this before creating the XBROWSE (look for XBROWSE inside fivedbu.prg):

SET DELETED OFF

and the deleted records are properly shown
Image

Re: View deleted records in xBrowse

PostPosted: Tue Dec 13, 2022 9:44 pm
by TimStone
Marc and Antonio,

Here is the problem. I have a File Editor built into my ( very large ) application. ( It is NOT FiveDBU though I do work with that. Mine is a full CLASS build and just for DBF at this time ).

In the Main() module, I use SET DELETED ON because my clients never want to see Deleted records.

However, in the Editor, it would be helpful to see them. IF I use SET DELETED OFF in the Editor, since it is MDI, it now applies that to anywhere in the full program, and DELETED records are suddenly visible.

Placing the SET command is the challenge. It would be easier if I had the ability to actually have it apply in the xBrowse ... but that may not be possible.

After looking at the source for the classes, and any documentation, I couldn't find any answer ..

Marc, thats a lot of overhead to do the indexing, and might not solve the problem anyway. Thanks for the idea ...

Tim

Re: View deleted records in xBrowse

PostPosted: Wed Dec 14, 2022 6:08 am
by nageswaragunupudi
Though SET DELETED ON/OFF is a global setting effecting all WorkAreas, it is still possible to do what you want. There are several ways. I will be posting a few samples soon. Please wait.

Re: View deleted records in xBrowse

PostPosted: Wed Dec 14, 2022 8:31 am
by Antonio Linares
Dear Tim,

you could use the xbrowse container window bGotFocus and bLostFocus to SET DELETED ON and OFF

Re: View deleted records in xBrowse

PostPosted: Thu Dec 15, 2022 10:25 pm
by TimStone
That didn't work ... at least with the ways I tried.

My TEMPORARY WORKAROUND is when I start the Editor, I SET DELETED OFF. Then, upon exit, using the VALID clause I can call a function to SET DELETED ON.

The main problem with this is it is still universal. So if they use the Editor, and don't end it, then SET DELETED OFF is still active, and every browse in the system will show the deleted records again.

What would be helpful is if we could isolate the deleted to the tDatabase class. For now, I will play with this to see if I can better protect it.

Re: View deleted records in xBrowse

PostPosted: Fri Dec 16, 2022 12:46 am
by James Bott
Tim,

It is possible to do INDEX ON ... FOR NOT DELETED

And you can create another index without that clause.

Then you can just switch indexes to get all records or only records not deleted.

I haven't tested this.

James

Re: View deleted records in xBrowse

PostPosted: Fri Dec 16, 2022 12:56 am
by TimStone
James,

My concern was my clients. I figured they wouldn't normally use this capability.

I resolved it by doing the following:

1) I left SET DELETED ON when starting the program
2) I put in a Menu item that calls a Function:

Code: Select all  Expand view

FUNCTION SelDelStatus

        IF MsgYesNo( "Do you wish to display deleted records ?" )
                SET DELETED OFF
        ELSE
                SET DELETED ON
        ENDIF

RETURN NIL
   
 


The ACTION statement refreshes the browse after running the function.

3) When exiting the editor, the program executes SET DELETED ON

With these steps I eliminated my concern. A client who uses the editor to simply make a change to raw data will not create any problems. Hopefully this will work.

There are already many indexes. I prefered not to go that route. The main reason for this capability is sometimes clients accidentally delete a record. When they call for help, I had to use a different program to recall the record. Now I can do it here, very easily.