Creating a Dynamic Table??
am 10.01.2007 16:32:08 von Ben EagleThis is a multi-part message in MIME format.
--===============1709404664==
Content-Class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C734CC.7D20D568"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C734CC.7D20D568
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
I am making a PDF , which using PDF::Table I am making a table inside
that PDF.
=20
What I am trying to do is make the table dynamic, cause I am passing
variables and I do not want a blank table row if the variable is empty.
This is what I have tried so far:
=20
my $some_data =3D[
["HP Hardware", "Total Cost"],
[$hardware1, $hardwareValue1],
[$hardware2, $hardwareValue2],
[$hardware3, $hardwareValue3],
[$hardware4, $hardwareValue4],
[$hardware5, $hardwareValue5],
[$hardware6, $hardwareValue6],
[$hardware7, $hardwareValue7],
[$hardware8, $hardwareValue8],
[$hardware9, $hardwareValue9],
[$hardware10, $hardwareValue10],
[$hardware11, $hardwareValue11],
[$hardware12, $hardwareValue12],
[$hardware13, $hardwareValue13],
[$hardware14, $hardwareValue14],
[$hardware15, $hardwareValue15],
];
=20
for (my $i=3D0; $i< scalar($some_data); $i++) {
=20
if ($hardware[$i] eq "") {
=20
}
=20
}
=20
=20
I am thinking if the variable is blank I want to delete the row from
$some_data, I don't know the syntax to do it,
=20
Any help or suggestions would be helpful, thanks
=20
Ben
------_=_NextPart_001_01C734CC.7D20D568
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
charset=3Dus-ascii">
style=3D'font-size:10.0pt;
font-family:Arial'>I am making a PDF , which using PDF::Table I am =
making a
table inside that PDF.
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>What I am trying to do is make the table dynamic, =
cause I am
passing variables and I do not want a blank table row if the variable is =
empty.
This is what I have tried so far:
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>my $some_data =3D[
style=3D'font-size:10.0pt;
font-family:Arial'> ["HP Hardware", =
"Total
Cost"],
style=3D'font-size:10.0pt;
font-family:Arial'> [$hardware1, =
$hardwareValue1],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware2,
$hardwareValue2],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware3,
$hardwareValue3],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware4,
$hardwareValue4],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware5,
$hardwareValue5],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware6,
$hardwareValue6],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware7,
$hardwareValue7],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware8,
$hardwareValue8],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware9,
$hardwareValue9],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware10,
$hardwareValue10],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware11,
$hardwareValue11],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware12,
$hardwareValue12],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware13,
$hardwareValue13],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware14,
$hardwareValue14],
style=3D'font-size:10.0pt;
font-family:Arial'> =
[$hardware15,
$hardwareValue15],
style=3D'font-size:10.0pt;
font-family:Arial'> ];
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>for (my $i=3D0; $i< scalar($some_data); $i++) =
{
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'> =
if
($hardware[$i] eq "") {
style=3D'font-size:10.0pt;
font-family:Arial'> =
&=
nbsp;
style=3D'font-size:10.0pt;
font-family:Arial'> =
}
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>}
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>I am thinking if the variable is blank I want to =
delete the
row from $some_data, I don’t know the syntax to do =
it,
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>Any help or suggestions would be helpful, =
thanks
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>Ben
------_=_NextPart_001_01C734CC.7D20D568--
--===============1709404664==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1709404664==--