View Categories

Events and data bands

< 1 min read

Besides the standard events for all components, databands have three special events: BeginRenderEvent, EndRenderEvent, and RenderingEvent. A data band must be created for each data row in the specified data source. For example, if the data source has 10 rows, the data band will be created 10 times. BeginRenderEvent is called before data is rendered. That is, when no data lines are printed. This event can be used to initialize some data or variables, or call some actions. EndRenderEvent is called when all data rows have been printed after the data band has been rendered. In this event data processing, total calculation processing is performed. RenderingEvent is called when rendering a single row of data. This event is called before a swath is printed. If these are 10 rows of data, the RenderingEvent will be emitted 10 times.

Calculates the number of elements in the data source. Write the following code in BeginRenderEvent.

myvariable = 0;

Also you need to create a myvariable variable in the data dictionary. Write the following code in the RenderingEvent.

myvariable = myvariable + 1;

EndRenderEvent is not used in this case. As a result of the calculation, myvariable will contain a value equal to the number of elements in the data source. To output this value to a text component, use the following expression:

{myvariable}

Also, the Text component's ProcessAtEnd property must be set to true. I need to print the calculated value in myvariable.