ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Attention : This is version 26 of this documentation page. This feature may have been changed or removed in a higher version.
This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / Managing triggers / WLanguage functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
HDescribeTrigger_55 (Function)
In french: HDécritTrigger_55
Warning
HDescribeTrigger_55 is equivalent to HDescribeTrigger available in the earlier versions.
This function is kept for backward compatibility (this function will still be supported in the forthcoming version).
HDescribeTrigger has evolved and it now proposes an advanced management of triggers. To benefit from these new features, use the new syntax of HDescribeTrigger.
Below is the documentation available in WINDEV 5.5.
 
Purpose
Adding or modifying a trigger on Hyper File. A trigger is a WLanguage procedure automatically called by the Hyper File whenever a Hyper File function is run.
Syntax
  • Syntax 1: Adding a trigger
    <ErrorCode>=HDescribeTrigger_55(<ListLogicalNameHFFile>, <ListNameHFFunction>, <NameWLanguageProcedure>, <Type>)
    • <ErrorCode> is an integer used to check the action of HDescribeTrigger
    • <ListLogicalNameHFFile> is a character string containing the logical name of one or more Hyper File files. To specify several names, the names of files must be separated by a comma (","). To specify all the analysis files, indicate "*".
    • <ListNameHFFunction> is a character string containing the name of one or more Hyper File functions (HAdd, HModify, HDelete). To specify several function names, they must be separated by a comma (",").
  • Syntax 2: Enabling/Disabling a trigger
    <ErrorCode>=HDescribeTrigger_55(<ListLogicalNameHFFile>, <ListNameHFFunction>, <Type>, <bEnable>)
    • <ErrorCode> is an integer used to check the action of HDescribeTrigger
    • <ListLogicalNameHFFile> is a character string containing the logical name of one or more Hyper File files. To specify several names, the names of files must be separated by a comma (","). To specify all the analysis files, indicate "*".
    • <ListNameHFFunction> is a character string containing the name of one or more Hyper File functions (HAdd, HModify, HDelete). To specify several function names, they must be separated by a comma (",").
  • Syntax 3: Destroying a trigger
    <ErrorCode>=HDrittenTrigger_55(<LogicalLogicalFileHF>, [<FunctionListHF> [,<Type>]])
    • <ErrorCode> is an integer used to check the action of HDescribeTrigger
    • <ListLogicalNameHFFile> is a character string containing the logical name of one or more Hyper File files. To specify several names, the names of files must be separated by a comma (","). To specify all the analysis files, indicate "*".
    • <ListNameHFFunction> is a character string containing the name of one or more Hyper File functions (HAdd, HModify, HDelete). To specify several function names, they must be separated by a comma (",").
    • <NameWLangageProcedure> is a character string containing the name of a WLanguage procedure
    • <Type> is one of the following WLanguage constants:
      • hTriggerBefore to run the WLanguage procedure before the Hyper File function
      • hTriggerAfter to run the WLanguage procedure after the Hyper File function
    • <bEnable> is a boolean set to True to enable the trigger and to False to disable it.
Details
  • You have the ability to define triggers on the following Hyper File functions: HModify, HAdd, HDelete, HWrite, HCross
  • The triggers are dynamically created by HDescribeTrigger_55. A trigger is always associated with a logical file. The parameters of a trigger are:
    • the logical name of file to which the trigger is applied
    • the name of the WLanguage property to call (it must be a global procedure without parameter)
    • the name of Hyper File function to which the trigger is applied
    • the type of trigger (BEFORE or AFTER)
  • The existence of global procedure is not checked when HDescribeTrigger_55 is called. A WLanguage error occurs if this function does not exist when the trigger is started.
  • The possible error codes for <ErrorCode> are:
    • 0: no error
    • 1: unknown logical file
    • 2: no current analysis
    • 3: unknown trigger
    • 4: unknown Hyper File function
    • 5: Hyper File function cannot be used with triggers
    • 6: unknown type
    • 7: empty name of WLanguage procedure (if the procedure name is an empty string)
  • You cannot define several procedures for the same logical file, the same Hyper File function, the same type. If a trigger already exists, it is replaced.
  • If <ListLogicalNameHFFile>="*", the command is applied to all files found in the current analysis (the files created by HDescribeFile and HAliasExternal are ignored)
  • A trigger procedure accepts no parameter. However, a number of Hyper File state variables are positioned before each call:
    • h.filename is a string containing the logical name of the file whose trigger is enabled
    • h.action is a character initialized to "A" for a Before trigger and to "P" for an After trigger.
    • h.TriggerFunction is a string that contains the name of Hyper File function that started the trigger
  • When running a before trigger, the execution of current Hyper File function can be canceled by assigning "A" to the Hyper File h.todo state variable: h.todo = "A"
  • If a BEFORE trigger and an AFTER trigger are defined for a Hyper File function and if the BEFORE trigger cancels the function (H.ToDo is set to "A"), then the AFTER trigger is not started.
Notes
  • In a Trigger procedure, the Hyper File functions can be called on any other file, including the current one (except to perform the same operation).
  • Caution: Any action on the current record in a process started by a trigger on HDelete, HModify or HCross is not recommended.
  • During the execution of the procedure called by trigger, if a Hyper File function is also triggered, the corresponding trigger will be released. You must take precautions in such cases to avoid deadlocks.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 01/01/2021

Send a report | Local help