SAL::WebDDR - Web-based reporting abstraction for SAL::DBI database objects
use CGI; use CGI::Carp qw(fatalsToBrowser); use SAL::DBI; use SAL::WebDDR; my $dbo_factory = new SAL::DBI; my $dbo_data = $dbo_factory->spawn_odbc('REPORTING_DSN',$report_user, $report_pass); $dbo_data->execute("sp_FinancialResults 'Q3'"); my $report = new SAL::WebDDR; $report->{datasource} = $dbo_data; $report->{dfm_column} = '0'; # Data Formatting Markup is in column 0 $report->{skip_fields} = 's 0 1 12 14 15 16 s'; # Do not display columns specified between the s's print "Content-type: text/html\n\n"; my $canvas = $report->build_report(); print qq[ <html> <head> <title>SampleCorp: Financial Results for Q3 2005</title> </head> <body> $canvas </body> </html> ];
This section describes some useful items in the SAL::WebDDR eponymous hash. Arrow syntax is used here for readability, but is not strictly required.
Note: Replace $SAL::WebDDR with the name of your database object... eg. $report->{datasource} = $dbo_data
$SAL::WebDDR->{datasource} is a reference to a SAL::DBI object
$SAL::WebDDR->{dfm_column} tells SAL::WebDDR where to look for DFM (Data Formatting Markup) tags $SAL::WebDDR->{skip_fields} specifies columns you want to skip in the reports output.
Builds a data-driven reporting object.
Builds a window-like html table using 3 scalars: $titelbar, $canvas, $statusbar. $width is optional.
Same as build_window() but uses an iframe for the main window content ($canvas). JScript is used to copy the contents of $canvas into the iframe.
Same as build_scroll_window() but the embedded iframe retrieves it's content from $url.
Build's a simple spreadsheet-like table using $datasource (a SAL::DBI object).
NOTE: This method does not use it's internal datasource connection. (~fixme)
If you want your numbers with commas, set $commify to a non-zero value.
If you'd like negative numbers highlighted, set $highlight_negatives to a non-zero value.
$width is optional, defaulting to 100%
Build's a data driven report. Please see the file 'salreport.cgi' in the samples directory.
Scott Elcomb <psema4@gmail.com>
SAL, SAL::DBI, SAL::Graph, SAL::WebApplication
To install SAL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SAL
CPAN shell
perl -MCPAN -e shell install SAL
For more information on module installation, please visit the detailed CPAN module installation guide.