Example of a trigger (onXXX) in VisualBasic?

Can anyone help me with such an example.

I’m running around in circles and can’t get Tamino to understand that I’m writing an OnXXX trigger.

Hi Marcel,

In order to write a trigger in VB, you should first add a Sub with the desired signature:

 
Public Sub onInsert(ByVal collection As String, _
                        ByVal doctype As String, _
                        ByVal ino_id As String, _
                        ByVal XMLObject As String)
' onInsert trigger

End Sub

Public Sub onUpdate(ByVal collection As String, _
                        ByVal doctype As String, _
                        ByVal ino_id As String, _
                        ByVal XMLObjectOld As String, _
                        ByVal XMLObjectNew As String)
' onUpdate trigger

End Sub

Public Sub onDelete(ByVal collection As String, _
                        ByVal doctype As String, _
                        ByVal ino_id As String, _
                        ByVal XMLObject As String)
' onDelete trigger

End Sub



After compilation you have to analyze the generated EXE file using X-Tension analyzer in System Management Hub. As onDelete and onInsert have the same signature, you have to choose the right type and can’t ‘Select with Defaults’.
After packaging, you should be able to install the generated SXP file.

If you should have further problems, please give more details.

Best regards,

Julius Geppert
Software AG

Marcel

Forgive me for using your request to solve my problem. I was about to post the same question when I saw yours. Julius I want to expand the question. I see that the XMLObject is passed as a string. Does this mean that as soon as the onXXXX event is fired, the complete xml document related to the doctype is passed as a string the the VB onXXXX sub?

The trigger gets the element, which it is defined on, and the whole subtree of it as a string. So if the trigger is added to the root node, it gets the whole document as a string. If it is defined on an leaf element, it only gets this.

It is possible to define triggers on more than one element. Each trigger is called with the respective subtree separately.

Best regards

Julius Geppert
Software AG