WorkWithPlus provides the possibility to insert event blocks in any template. This is useful when you need to insert some code repetitively in many objects, in some event or sub.
In order to do this, you have to insert a node within the Events & Subs node of the correspondent template:
The customer needs to mention in the title of the form of every transaction the action that the end-user is doing(inserting, updating, or deleting a record).
As it is a code that you have to insert in every transaction, WorkWithPlus provides a mechanism for doing this massively: create a block code in Start Event, position bottom which contains the following code:
You can copy the following code:
Do case
case &Mode = TrnMode.Insert
Form.Caption += " (Insert)"
case &Mode = TrnMode.Update
Form.Caption += " (Update)"
case &Mode = TrnMode.Delete
Form.Caption += " (Delete)"
EndCase
Tip: The Include property (present only for Transaction Templates) allows you to define if the block must be included only once (Once) or if it must be added when a certain condition is met in an attribute (Once per matching attribute).
Then, save the WorkWithPlus Settings and select "Yes" in the following message so the "Update Instances" process, in order to propagate the changes made in the template, is executed:
Run the application and go to every transaction at runtime in order to check that the new behaviour was added:
Finally, open the transaction and check that the block code was added in the Start event, inside the code generated automatically by WorkWithPlus.
You can learn more at Event Blocks
Well done! You should now be able to:
- Add an Event Block in order to automatize the KB behaviour
- Use the "Update Instances" process in order to propagate the changes made in the template
|