Re: How to use rlib with offline datasources (CSV, XML)

Bob Doan <[email protected]> Fri, 29 Jun 2007 16:16:31 -0400
Newsgroups gmane.text.rlib.user
Message-ID <[email protected]>
Hi,

You need to do something like:

rlibc::rlib_add_datasource_csv($rlib, "local_csv");
rlibc::rlib_add_query_as($rlib, "local_csv", "data.csv", "data");

The correct structure of the csv data file is 1st row is the header.

Look at rlib/src/examples/php/csv.php as a good working example.

There is no way to store it into a file, but it would be very easy to
add.

- Bob

On Fri, 2007-06-29 at 12:34 +0200, Werner Bochtler wrote:
> I'm new to rlib and don't know how to use a csv file as datasource.
> 
> What I have done so far using perl:
> 
> #!/usr/bin/perl
> use strict;
> use rlib;
> 
> my $rlib = rlibc::rlib_init();
> rlibc::rlib_add_datasource_csv( $rlib, "data.csv" );
> rlibc::rlib_add_report( $rlib, "products.xml" );
> rlibc::rlib_set_output_format_from_text( $rlib, "pdf" );
> rlibc::rlib_execute( $rlib );
> rlibc::rlib_spool( $rlib );
> rlibc::rlib_free( $rlib );
> exit 0;
> 
> ------
> 
> This results in "No queries added to report".
> 
> My questions:
> 
> What is the correct structure of the csv data file?
> I assume that a header line containing the field names is required. Is
> this corect?
> 
> Can you give an example for an XML data file?
> 
> How can I solve the "No queries to report" problem?
> 
> I assume that I have to use rlib_add_query_as() but don't know how?
> 
> Last question:
> Is there a way to store the generated report in a file?
> 
> 
> Thanks in advance,
> 
> Werner
> 
> 
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Rlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rlib-users
-- 
Bob Doan
Vice President of Information Technology
SICOM Systems
[email protected]
800-547-4266 x217


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/