Event driven reporting

[Top]  [Chapter]  [Previous]  [Next]

To completely control the report creation use the events of TextDynamic.


There are three events, one controls the group processing,

one reads the values of fields and one reads out variables.






To outline the idea of the events we use some simple C# code:




This event is triggered before and after a group is started. You use it to move to the next data record or initalize a query. Here we simply use the Count property to abort after 10 rows.


private void wpdllInt1_OnReportState(

 object Sender, string Name,

 int State, WPDynamic.IWPReportBand Band,

 ref bool Abort)


 if (State==WPDynamic.commands.REP_BeforeProcessGroup)

                          Abort = Band.Count>10;

 else Abort = false;





This event is triggered to fill in field data. It is the same as the one for the regular mail merge. Here we simply print an incremented number.


static int a;

private void wpdllInt1_OnFieldGetText(object Sender, int Editor,

 string FieldName, WPDynamic.IWPFieldContents Contents)


 Contents.StringValue = Convert.ToString(a++);



The image shows the result






It is triggered to read the value of a variable which is used in a formula. Please don't mix up with group variables used by the reporting engine, those group variables contain the formulas which itself contain the variables which trigger this event. In fact any unknown name inside a formula will trigger the event OnReadFormulaVar.

[event_driven_reporting.htm]    Copyright © 2007 by WPCubed GmbH