- my $previous_col;
- my $i=1;
- while (my @data = $dbcalc->fetchrow) {
- my ($row, $col )=@data;
- $col = "zzEMPTY" if ($col eq undef);
- $i=1 if (($previous_col) and not($col eq $previous_col));
- $table[$i]->{$col}=$row;
-# warn " ".$i." ".$col. " ".$row;
- $i++;
- $previous_col=$col;
- }
-
- push @loopcol,{coltitle => "Global"} if not($column);
-
- my $max =(($line)?$line:@table -1);
- for ($i=1; $i<=$max;$i++) {
- my @loopcell;
- #@loopcol ensures the order for columns is common with column titles
- # and the number matches the number of columns
- my $colcount=0;
- foreach my $col ( @loopcol ) {
- my $value;
- if (@loopcol){
- $value =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}};
- } else {
- $value =$table[$i]->{"zzEMPTY"};
- }
- push @loopcell, {value => $value} ;
- }
- push @looprow,{ 'rowtitle' => $i ,
- 'loopcell' => \@loopcell,
- 'hilighted' => ($hilighted >0),
- };
- $hilighted = -$hilighted;
- }
-
-
+ my $previous_col;
+ $i=1;
+ while (my @data = $dbcalc->fetchrow) {
+ my ($row, $col )=@data;
+ $col = "zzEMPTY" if (!defined($col));
+ $i=1 if (($previous_col) and not($col eq $previous_col));
+ $table[$i]->{$col}=$row;
+# warn " $i $col $row";
+ $i++;
+ $previous_col=$col;
+ }
+
+ push @loopcol,{coltitle => "Global"} if not($column);
+
+ $max =(($line)?$line:@table -1);
+ for ($i=1; $i<=$max;$i++) {
+ my @loopcell;
+ #@loopcol ensures the order for columns is common with column titles
+ # and the number matches the number of columns
+ my $colcount=0;
+ foreach my $col ( @loopcol ) {
+ my $value;
+ if (@loopcol){
+ $value =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}};
+ } else {
+ $value =$table[$i]->{"zzEMPTY"};
+ }
+ push @loopcell, {value => $value} ;
+ }
+ push @looprow,{ 'rowtitle' => $i ,
+ 'loopcell' => \@loopcell,
+ 'hilighted' => ($hilighted >0),
+ };
+ $hilighted = -$hilighted;
+ }
+
+