Welcome! Log In Create A New Profile

Advanced

Duplicate Error Window

Posted by Michael Drechsel 
Michael Drechsel
Duplicate Error Window
May 20, 2008 01:49PM
Hi,

if I use hadd and add a record with a same key, Windev shows me a own window with "the security mechanism of ..." and after I click "cancel" I see my error message. How can i disable the first error window ???

Greetings MD
Louis Verbraak
Re: Duplicate Error Window
May 20, 2008 02:05PM
Hello Michael,

See HOnError.
Michael Drechsel
Re: Duplicate Error Window
May 20, 2008 02:51PM
Hi Louis,

thx. My mistake was that I used the name of the query in honerror.

regards md
GuenterP
Re: Duplicate Error Window
May 20, 2008 03:16PM
Quote
Michael Drechsel
Hi,

if I use hadd and add a record with a same key, Windev shows me a own window with "the security mechanism of ..." and after I click "cancel" I see my error message. How can i disable the first error window ???

Greetings MD

Hi Michael,

before storing a record I'm doing a test, whether there is a duplicate error to come up on the unique key/s of the record. Schematically:

MyPosition = HSavePosition(..)
IF HreadSeek(..) THEN
Error("Duplicate already in File ..
HRestorePosition(MyPosition)
ELSE
HRestorePosition(MyPosition)
HAdd(..)
END

Same applies to HModify(..) before actuially modifying the record.

This way, such windows never will be shown.
Michael Drechsel
Re: Duplicate Error Window
May 20, 2008 05:14PM
Hi Guenther,

I don´t see any advantage in your method. Why you don´t use the build in functions ??

greetings md
Al
Re: Duplicate Error Window
May 20, 2008 05:17PM
Hello Guenter

Doesn't the method you use destroy the data in the current/new record buffer, so that when you return to your saved position you would need to refill the file field information ?

For the same purpose, I use HSeek() as it will establish the fact of a duplicate or not, is faster than HReadSeek() and will not destory the data in the current record read buffer.

Regards
Al
Al
Re: Duplicate Error Window
May 20, 2008 05:24PM
Hello Michael

I use a similar method to Guenter.
The reasons for me are:

It is quicker than allowing the built in functions
Allows more control over the process of reporting and dealing with the error
(these are subjective reasons)

Critically for me, I cannot use the built in functions because I run all my projects with integrity turned off. I only use integrity when I am developing to test my links and data entry processes. I turn it off in production because the database performs faster without it.

Regards
Al
GuenterP
Re: Duplicate Error Window
May 20, 2008 05:26PM
Hi Michael,

yes, I could use the HOnError(..) and handle that etc but <b>I decided in general not to provoke needless errors when using any file system</b>. This proved to be very useful in the past, because in some environments it's not so clear whether the file buffer is still valid after the error message, destroyed by incomplete operations or even error messages written to the file buffer. So, I do know that the file buffer is still there - unharmed. On the other hand, if a run time error comes up I positively know that this's an error I didn't take care of beforehand and probably that error should be shown to the user in all its glory i.e. using option ErrorFullDetails.



Edited 1 time(s). Last edit at 05/20/2008 05:32PM by GuenterP.
Pedro Santana Viera
Re: Duplicate Error Window
May 20, 2008 05:27PM
very good point Al, for me. I was using HAlias before HReadSeek when I needed because of didn't knew of HSeek(). Learning every day...

kind regards,

Pedro Santana Viera
GuenterP
Re: Duplicate Error Window
May 20, 2008 06:03PM
Quote
Al
Hello Guenter

Doesn't the method you use destroy the data in the current/new record buffer, so that when you return to your saved position you would need to refill the file field information ?

For the same purpose, I use HSeek() as it will establish the fact of a duplicate or not, is faster than HReadSeek() and will not destory the data in the current record read buffer.

Regards
Al

Hi Al, in fact I'm using HSeek() too where the presence of a key is the point only. But in a Form-environment the difference between HReadSeek() and HSeek() is not significant. Anyway, HSeek() changes the location of the file pointer as HReadSeek() does. The commands HsavePosition() and HRestorePosition() are essential in that context.
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: