Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 8 Jahren, 11 Monaten
Letzter Beitrag:
vor 8 Jahren, 11 Monaten
Beteiligte Autoren:
David Egan, Al, Jimbo

Trigger on HF Database; what use are they?

Startbeitrag von David Egan am 24.06.2009 08:43

Hi
Using MSSQL database we regularly use triggers to update totals in header records. The database effectively holds 2 buffers, one with the original record and one with the new record. I have tried to do the same in HF (client side trigger but from what I can see, a server side trigger works the same), using before & after triggers on my detail file but it doesn't work. The before trigger should decrement the total by the original detail amount and the after trigger should increment it by the new detail amount. As far as I can tell though, there is only one buffer for the file so you can't access before & after details.
Is there something I am missing or is this just not possible with HF? If this is not possible, apart from writing log files I can't see that triggers are much use.

Thanks

David

Antworten:

Hi David, I'm using before triggers to automatically build key-strings which are later on to be used for combo-boxes to let users choose a record from the file. In some cases I build complex composite key values from several fields of the record before storing it. In general, whenever the record is HAdded() or HModify()-d then the keys are built, the trigger takes care of it automatically. There are many other uses for triggers. I'd like to see an HRead..()-Trigger to prepare certain values from the record, again automatically. I heard a 'yes' from PC Soft some years ago but there's still no trigger on Hread..(). Liefe's tough. Guenter

von Jimbo - am 24.06.2009 10:24
Hello David

Could you use the FileToMemory() command to create your own buffer record as part of your first trigger.

Regards
Al

von Al - am 24.06.2009 12:25
Thanks Guenter, Al.
Your suggestion put me on the path of a solution Al. The problem was easily solved by creating an alias of the detail file in project initialisation and then using that in the before trigger to get the initial values.

Cheers

David

von David Egan - am 26.06.2009 04:55
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.