You are here: Reference Guide > Report Writing > Order of Events

Order of Events

When a report is run from the Jiwa menu, the following tasks are performed by Jiwa:

    1. LoadReport – Any formulae that are named starting with “Pass_” and that appear as comments in the “Record Selection Formula” of the report are passed.  Based on this passing, the ranges grid on the ranges tab of the report screen is set up.
    2. UpdateReport – When the user clicks on the “Print” button on the report screen (below), the following occurs:


    1. Tables, views, store procedures, etc. that are in the report have their “locations” changed from the server/database they were developed against to the server/database that the report is currently being executed in.
    2. Formulae in the “Record Selection Formula” that are named starting with “Pass_” are replaced with the value that the user selected for them in the ranges grid of the report screen.
    3. If the Crystal report has any parameter formulae (these appear if the report is referencing a stored procedure that accepts parameters), Jiwa performs some matching to “normal” Crystal report formulae based on naming:

      If the name of a Crystal formula minus the leading “Pass_” is equal to the name of a Crystal parameter formula, then the value of the Crystal formula is pushed into the Crystal parameter formula.

      This allows integration with reports that call stored procedures that require parameters to be set. 

    4. The auto-populated formulae have their values set by Jiwa.
    5. The report settings formulae are parsed and their values pushed through to the underlying Crystal report engine.
    6. The underlying Crystal report engine is told to execute the report.

Once the report has finished executing (i.e. received all of the required data from the SQL Server and rendered all of the report pages), the focus moves from the “Ranges” tab on the report screen to the “Report” tab such that the result is shown to the user (via the embedded Crystal Reports Viewer ActiveX control). 

Note that there is a 3rd tab labelled “Formula” that only the “admin” Jiwa user can access.  It contains some useful debugging information including, at the very bottom, the final SQL query that was sent to the SQL server.

Refer to "Appendix A"

Copyright © 2012 Jiwa Financials. All rights reserved.