Provide the data source (GRW for Swift)
A report is only as good as the data it serves. The data source defines where and how you get your data.
You are responsible for creating the code that serves as the data source. The Genero Report Writer expects XML; your data source needs to generate XML. You must define the data model and serialize it to XML. You can either generate the code using the Business Application Modeler, or you can write the code by hand.
Generate the data model
You can generate the data model using the Business Application Modeler. It creates the classes and populates the classes using SQL. It provides the functions and/or methods needed to serialize the XML. In addition, the data schema is created for you.
To generate the data model, see Quick Start: Generate a Swift report application.
Write the data model
You can write the data model by hand. When you manually create the data model, you are responsible for the code that creates and populates the classes, and that serializes the data to XML.
In the demo project OrderReportSwift.4pw, the reporting library contains sample files for you to examine. While these files are officially unsupported, they provide you with examples to guide you in creating your own data models. The code includes the use of the C APIs, which are documented in detail in the Genero Report Writer C API documentation.
If you are retrieving data from a database, examine the files
DBConnection.swift, DBResultset.swift, and
DBStatement.swift
. These files include the import odbc
statement at the top of each file; this imports the unixodbc functions used within the
examples.
The file SerializeData.swift provides an example of the code that you would use to move the data, based on the data type, to the content handler. Functions that work with the content handler are provided by the Genero Report Writer C APIs, which are fully documented in the Genero Report Writer C API documentation.
To see an example of a hand-coded Swift project, see Quick Start: Write a Swift report application.