Open topic with navigation

Report PDF - Events

If you need do something more specific on you reports, you can program it, using events. For example if you want to sum two fields and move this result to another one, before printing the record, just edit the event OnRecord and write a code similar to this:
{field_c} = {field_b} + {field_a};

Here you are free to program PHP, just remember the character { } , around the field name to make reference the local variables, using [ ], you are making reference to global variables.

Scriptcase uses the concept of events to enable the developer to customize application code. Events allow the developer to define custom actions at a specific execution time (e.g. After a record is inserted, when it is loaded, upon submitting a form, ...) and for a specific type of application.

onApplicationInit - Occurs when the application is initiated.

onScriptInit - Occurs every time the application is loaded.

onRecord - This event is executed before printing each record.

onHeader - This event is executed immediately before printing the header. Use this event, for example, to print a calculated value in the header.

onFooter - This event is used to show some calculated value on the footer.

Any event can use pre-defined functions (macros) that are available in Scriptcase. These functions are called "Scriptcase Macros".