Skip to Content
avatar image
Former Member

Report off CSV data source

Hi guys,

We are using Crystal Report Server XI R2. My report uses multiple CSV files as report data source. We would like to use Java SDK to dynamically pass data source to the report. I was just wondering what is the best way for my java code to load and pass csv files to the report? All csv files for the report will be extracted to a specific folder and I know the path to the folder before running the report. All advices will be highly appreciated.

Thank you,

Jundong

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Sep 02, 2008 at 01:51 PM

    The Report Application Server (RAS) SDK that allows for data "push" (injecting data from code into a Crystal Report) via the RAS server on Crystal Reports Server accepts java.sql.ResultSet via the DatabaseController.setDataSource method.

    You'd need to, in your code, transform the CSV into a java.sql.ResultSet.

    A sample for using ResultSet and RAS SDK is [here|https://boc.sdn.sap.com/node/3211] in RAS\set_resultset_datasource.

    So the component you'd supply is the CSV -> ResultSet conversion.

    One way is to use the POJO Factory described [here|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/JRC_SDK/jrc_pojo_api_doc/doc/jrcsdk_java_pojo_apiRef/overview-summary.html] - find pojoSample.jar file in your deployment. It provides a POJO -> ResultSet conversion factory method. So you can CSV -> POJO -> ResultSet.

    Sincerely,

    Ted Ueda

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Ted,

      I read those examples you mentioned. To set a datasource in a Crystal report DatabaseController, it requires a table name. I was just wondering is the table name equals to csv file names set as datasource in the 'Set Datasource Location' dialog in Crystal Report Designer (user.csv displayed as user_csv in the dialog)? So if my report use mutiple CSV files, I should load them one by one and then set them with the DataBaseController?

      Thank you,

      Jundong