From: Bob D. <bd...@si...> - 2003-10-31 18:29:26
|
Problem looks like it is you ;) In your table you define the field as "countryID" but in the xml you reference it as "country_ID" Thats why it is 0... and now you might ask why it is 0 Well... RLIB goes through a progression on how to resolve fields... first it trys the main loop.. then it tryes other datasources... like datasource.field .. then it tries variables (v.something) .. and environment memory variables (m.something).. then if it can't find a match it thinks that it is a number... and good old atoi will turn a string into 0 - Bob On Fri, 2003-10-31 at 12:31, Andrew Cotter wrote: > >Wait.. does it launch the plugin or not.. I'm confused and tired ;) > > >- bob > > Plugin does launch in all browsers (PDF and CSV format). > > My problem now is the formatting / output of a different tables data. > > > tblkey_country > +-----------+-------------------+---------------+ > | countryID | country_txt | country_short | > +-----------+-------------------+---------------+ > | 1 | Australia | AU | > | 2 | Canada | CA | > | 3 | France | FR | > | 4 | Germany | DE | > | 5 | Portugal | PT | > | 6 | Mexico | MX | > | 7 | Puerto Rico | PR | > | 8 | United Kingdom | GB | > | 9 | United States | US | > | 10 | US Virgin Islands | VI | > | 11 | Ireland | IR | > +-----------+-------------------+---------------+ > > report1.php > ***************** BEGIN PHP SNIPPET ******************* > <? dl("libr-php.so"); > > // $format = "html"; // see following line > $format = $_GET['type']; // I feed the format in the URL - no > problem here. > > $sql_host = "localhost"; > $sql_users = "reports"; > $sql_password = ""; > $sql_database = "test"; > $rlib = rlib_init(); > > rlib_add_datasource_mysql($rlib, "mysql", $sql_host, > $sql_users, $sql_password, $sql_database); > rlib_add_query_as($rlib, "mysql", "select tblkey_country.* > from tblkey_country", "country"); > rlib_add_report($rlib, "report1.xml","country"); // Tried > 3rd value - nothing different. > rlib_set_output_format($rlib, $format); > rlib_execute($rlib); > > header( rlib_get_content_type($rlib)); > > rlib_spool($rlib); > rlib_free($rlib); > ?> > ***************** END PHP SNIPPET ********************* > > > report1.xml - rest of the file is the same as the example > ***************** BEGIN XML SNIPPET ******************* > <Detail> > <FieldHeaders> > <Output> > <HorizontalLine size="1" bgcolor="'black'"/> > <Line bgcolor="'0xe5e5e5'"> > <text width="15" col="1">countryID</text> > <text width="1"/>r > <text width="20" col="2">Country</text> > <text width="1"/> > <text width="15" col="3" align="right">Country > Code</text> > </Line> > <HorizontalLine size="1" bgcolor="'black'"/> > <HorizontalLine size="4" bgcolor="'white'"/> > </Output> > </FieldHeaders> > <FieldDetails> > <Output> > <Line bgcolor="iif(r.detailcnt%2,'0xe5e5e5','white')"> > <field value="country_ID" width="15" align="left" > col="1"/> > <text width="1"/> > <field value="country_txt" width="20" align="left" col="2"/> > <text width="1"/> > <field value="country_short" width="15" > format="'%s'" align="right" col="3"/> > </Line> > </Output> > </FieldDetails> > </Detail> > ***************** END XML SNIPPET ********************* > > Attached is the PDF output. > > > Any help would be wonderful! > > Andrew |