Welcome! Log In Create A New Profile

Advanced

WD24 - hCross().

Posted by AadG 
WD24 - hCross().
June 26, 2020 01:09PM
Hi all,

I'm looking into hCross() to find out if it is usable on a daily basis. Always handy when a "deleted" record can be recovered.
It's not clear to me how a crossed record can be determined in a file. I know that hModify or hWrite can re-enable a record,
but then I need to know which record en where to find it.

Has anybody any experience with hCross?

Thanks for any tips.

Best regards,

Aad
Argus
Re: WD24 - hCross().
June 26, 2020 04:17PM
I would advise against using it.
May not be supported by all DB.
Needs a specific mechanism to be used...

Instead, just add a bDeleted boolean in all your files... And set it to true when a user "deletes" a record...
A simple query or filter will let you find either deleted record or not, and modifying the status is regular code.

I haven't really deleted a record in a DB for a good number of years now, just using that boolean instead. Very good for tracability too.
Re: WD24 - hCross().
June 27, 2020 11:37AM
Hi Argus,

Nice idea. This will work.

Best regards,

Aad
Argus
Re: WD24 - hCross().
June 27, 2020 10:04PM
>
> Nice idea. This will work.

It is a nice idea... but it's not MY idea...

I learned that one from Fabrice Harari a few years back... I THINK it was in his 'best practices' video course.

Just giving credit where it's due.
Re: WD24 - hCross().
June 28, 2020 12:46PM
Like I said earlier, I liked Fabrice Harari's idea, but in my specific case, it's to much work to implement.
I took the liberty to snoop around on the PCSoft forum and found a piece of code by Piet van Zanten (2008 spinning smiley sticking its tongue out)

This code was exactly what I was looking for. Easy to implement to get records back.

Best regards,

Aad

i is int
FOR i=1 TO HNbRec(VVE,hStateAll)
HRead(VVE,i)
IF HState() = hStateCrossed THEN
Info("Customer Name : "+VVE.Naam)
IF YesNo("Activate this record again?") = Yes THEN HModify(VVE)
END
END
Al
Re: WD24 - hCross().
June 29, 2020 02:56AM
Hello Aad

You could create a file of HCrossed records to speed up the lookup and restore
Every time you use HCross() add a record containing Filename, Hrecnum(), date & time, NetworkUser() - the guilty person - to the deleted records file
With an index on the filename and the date/time you could quickly isolate records and restore directly from the record number without having to go through the whole file

Regards
Al
Re: WD24 - hCross().
June 29, 2020 12:31PM
Hi Al,

Good suggestion. Thanks for your constructive answer.

Best regards,

Aad
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: