Just wanted to share this technique and see how others achieve the same thing. Anyone else doing something similar or have a better trick?


Here's some code that creates a nice, compact table definition around a set of tuples returned from a database (in this case gnucash).


[- $oldmaxcol = $maxcol;
   $maxcol = 3;
-]

<TABLE border="1">

[- # read in a record from the gnucash database using the Pg interface
   @accountinfo=$gnucash_accounts->fetchrow;
-]

<TR><TD>[+ $accountinfo[$col+$row-$row] +]</TD></TR>

</TABLE>

[- $maxcol = $oldmaxcol; -]

=======================================

I'm using $row-$row ($row minus $row equals zero) in the arrary reference just to get Embperl to see the $row reference in a statement and stop outputting the table when no more records are read from the database ( $accountinfo[$col+$row-$row], which is the same as $accountinfo[$col] will be undefined if a record is not read).

The purpose of the code is to minimize the lines of code to get the table generated properly.


Thanks!


Ricahrd Schilling

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to