Creating a report using an MSXML schema file

MSXML data sources can replace database connections when creating and running a report

Note:

MSXML schema files are currently used in reports created with C#.

To create a report using an MSXML schema file:

  1. Create a new BAM C# project.
  2. Click Database > Import MS XML Schema ... and select the MSXML schema file.
    The database file (.4db) file is created.
  3. Save the database file (.4db) file.
  4. Click File > New > C# > Report Data from Database (.4rdj).
  5. Select the desired fields and click Finish.
    The data model diagram (.4rdj) file is created.
  6. Save the data model diagram (.4rdj) file.
  7. Click Build > Compile File to compile the data model diagram and generate an .xsd file.
  8. Click File > New > Reports and select a report type.
  9. Open the Data View and browse for the .xsd generated from the .4rdj file.
  10. Add fields to your report.
  11. Open AppData.cs file within the ReportLauncher library.
  12. Remove code applying to database connection, insert code using MSXML as a data source. For example:
    Open the AppData.cs file and remove the following lines of code:
    // Get Data Provider and connection string from environment variable
    String provider = Environment.GetEnvironmentVariable("ADO_PROVIDER");
    String connectionString = Environment.GetEnvironmentVariable("ADO_CONNECTION_STRING");
    DbProviderFactory dataFactory = DbProviderFactories.GetFactory(provider);
    // Create the database connection
    using (DbConnection connection = dataFactory.CreateConnection()) { 
        // Create the data model instance
        connection.ConnectionString = connectionString;
    connection.Open();
    Then add the following lines of code and save the file:
    using FourJs.Report.BAM.SQLReports.MsXmlDataSource;
    String xmlFilePath = Environment.GetEnvironmentVariable("MSXML_FILE_PATH");
    String converterPath = Environment.GetEnvironmentVariable("MSXML_CONVERTER_PATH");
    using (DbConnection connection = MsXmlDataSource.CreateInstanceFromMsXml(xmlFilePath, converterPath))
     {
  13. Open the Genero Configuration Management window and click the plus icons to add the two environment sets for the input file path and converter path.
  14. For the input file path, add the following environment variables and click OK:
    • Type - File
    • Name - MSXML_FILE_PATH
    • Value - $(ProjectDir)/msxml/'msxml database file'
  15. For the converter path, add the following environment variables and click OK:
    • Type - File
    • Name - MSXML_CONVERTER_PATH
    • Value - $(GSTDIR)/lib/msxmlconvert.jar
  16. Execute the application.
    The Report Launcher window opens.
  17. For the Select data model class to run section, click Add and navigate to the DataSourceLib.dll file in your project.
  18. For the Select report design section, click Add and navigate to the report design document .4rp file in your project.
  19. Click Run.
    The report is run using the MSXML database schema file.