Skip Menu |

This queue is for tickets about the LaTeX-Table CPAN distribution.

Report information
The Basics
Id: 75203
Status: resolved
Priority: 0/
Queue: LaTeX-Table

People
Owner: Nobody in particular
Requestors: danieljamesscott [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Extracting data from database and generating LaTeX table
Date: Tue, 21 Feb 2012 17:44:03 -0500
To: bug-latex-table [...] rt.cpan.org
From: Dan Scott <danieljamesscott [...] gmail.com>
Hi, I'm using LaTeX::Table to generate LaTeX tables from data extracted from a database. I'm using the DBI module to connect to an Oracle database and run a query. The results are entered into an 'array of array references' using fetchall_arrayref() which can be processed using LaTeX::Table. There seems to be a problem for some of my queries, most are working fine, and I get nicely formatted LaTeX tables. However, I occasionally receive the following: Attribute (data) does not pass the type constraint because: Validation failed for 'ArrayRef[ArrayRef[Value]]' with value [ [ 5994, 4828, 25.19514, undef ], [ 5995, 4828, 25.85458, 15 ], [ 30325, 24431, 24.61293, 17 ], [ 30326, 24431, 24.64457, undef ], [ 41166, 27109, 28.6202, 18 ], [ 41167, 27109, 28.63751, undef ] ] at ./test_latex_table.pl line 39 I believe that this is due to the null values in the 4th column. These are returned from DBI set to 'undef' and seem to be causing problems for LaTeX::Table. Is it possible to fix this without having to loop through all of the data converting the 'undef's into blank strings or into text saying '(null)'? Many thanks, Dan Scott
Hi Dan, thanks, undef values are now allowed. You can get the tarball at https://github.com/downloads/lima1/p5-latex-table/LaTeX-Table-1.1.tar.gz To avoid warnings, you can use a callback function to set the value: $table = LaTeX::Table->new( { environment => 0, header => $test_header, data => $test_data, callback => sub { my ( $row, $col, $value, $is_header ) = @_; if (!defined $value) { $value = 'NA'; } return $value; } } ); Will upload that to CPAN in a few days. Best, Markus On Tue Feb 21 17:44:56 2012, danieljamesscott@gmail.com wrote: Show quoted text
> Hi, > > I'm using LaTeX::Table to generate LaTeX tables from data extracted > from a database. I'm using the DBI module to connect to an Oracle > database and run a query. The results are entered into an 'array of > array references' using fetchall_arrayref() which can be processed > using LaTeX::Table. > > There seems to be a problem for some of my queries, most are working > fine, and I get nicely formatted LaTeX tables. However, I occasionally > receive the following: > > Attribute (data) does not pass the type constraint because: Validation > failed for 'ArrayRef[ArrayRef[Value]]' with value [ [ 5994, 4828, > 25.19514, undef ], [ 5995, 4828, 25.85458, 15 ], [ 30325, 24431, > 24.61293, 17 ], [ 30326, 24431, 24.64457, undef ], [ 41166, 27109, > 28.6202, 18 ], [ 41167, 27109, 28.63751, undef ] ] at > ./test_latex_table.pl line 39 > > I believe that this is due to the null values in the 4th column. These > are returned from DBI set to 'undef' and seem to be causing problems > for LaTeX::Table. Is it possible to fix this without having to loop > through all of the data converting the 'undef's into blank strings or > into text saying '(null)'? > > Many thanks, > > Dan Scott