Duplicate Error Window

Startbeitrag von Michael Drechsel am 20.05.2008 11:49

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

Antworten:

Hello Michael,

See HOnError.

von Louis Verbraak - am 20.05.2008 12:05
Hi Louis,

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

regards md

von Michael Drechsel - am 20.05.2008 12:51
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.

von GuenterP - am 20.05.2008 13:16
Hi Guenther,

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

greetings md

von Michael Drechsel - am 20.05.2008 15:14
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

von Al - am 20.05.2008 15:17
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

von Al - am 20.05.2008 15:24
Hi Michael,

yes, I could use the HOnError(..) and handle that etc but I decided in general not to provoke needless errors when using any file system. 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.

von GuenterP - am 20.05.2008 15:26
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

von Pedro Santana Viera - am 20.05.2008 15:27
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.


von GuenterP - am 20.05.2008 16:03
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.