<html><head></head><body bgcolor="#FFFFFF"><div>I'm late to the party here but you're using Catalyst, what's wrong with the spreadsheet view? (forgive me for not linking it)<br><br>Sent from my iPhone</div><div><br>On Jul 6, 2012, at 8:09 AM, Kenneth S Mclane <<a href="mailto:ksmclane@us.ibm.com">ksmclane@us.ibm.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><tt><font size="2"><br>
> your code will only work for fields in the main table of your resultset,<br>
> but will break for relations. for example,<br>
> $data->department.department_code is not a valid accessor. you
will have<br>
> to parse your field definition and convert it into<br>
> $data->department->department_code in order to retrieve the
data.<br>
> <br>
> HTH<br>
> <br>
> patrick<br>
> <br>
> -- <br>
> Patrick Meidl ........................ <a href="mailto:patrick@pantheon.at">patrick@pantheon.at</a><br>
> Vienna, Austria ...................... </font></tt><a href="http://gplus.to/pmeidl"><tt><font size="2">http://gplus.to/pmeidl</font></tt></a><tt><font size="2"><br>
</font></tt>
<br><tt><font size="2">Ok, I now have this code:</font></tt>
<br>
<br><tt><font size="2">my @fields = qw/ department.department_code account_code
account_name account_policy compliance.percent_compliant metrics.num_servers
metrics.num_subsystems progress.percent_complete /;</font></tt>
<br><tt><font size="2"> foreach my $field
(@fields) {</font></tt>
<br><tt><font size="2">
$ws->write($row, $col, $field);</font></tt>
<br>
<br><tt><font size="2">
$col++;</font></tt>
<br><tt><font size="2"> }</font></tt>
<br><tt><font size="2"> $col=0;</font></tt>
<br><tt><font size="2"> $row++;</font></tt>
<br><tt><font size="2"> while (my @data
=$sr->next) {</font></tt>
<br><tt><font size="2">
foreach my $data (@data) {</font></tt>
<br><tt><font size="2">
foreach my $field
(@fields) {</font></tt>
<br><tt><font size="2">
if ($field =~ /\./) {</font></tt>
<br><tt><font size="2">
$field = join(
"->", split( /\./, $field));</font></tt>
<br><tt><font size="2">
}</font></tt>
<br><tt><font size="2">
$ws->write($row, $col, $data->$field);</font></tt>
<br>
<br><tt><font size="2">
$col++;</font></tt>
<br><tt><font size="2">
}</font></tt>
<br><tt><font size="2">
$col=0;</font></tt>
<br><tt><font size="2">
} </font></tt>
<br><tt><font size="2">
$row++;</font></tt>
<br><tt><font size="2"> }</font></tt>
<br><tt><font size="2">Which gives this error:</font></tt>
<br><tt><font size="2">Caught exception in dbms::Controller::AccountView->list
"Can't locate object method "department->department_code"
via package "dbms::Model::ORANGES::Account" at /opt/catalyst/dbms/script/../lib/dbms/Controller/AccountView.pm
line 65."</font></tt>
<br>
<br><tt><font size="2">The if replaces the "." with a "->"
as you can see. <br>
</font></tt></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class</a></span><br><span>IRC: irc.perl.org#dbix-class</span><br><span>SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/">http://dev.catalyst.perl.org/repos/bast/DBIx-Class/</a></span><br><span>Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a></span></div></blockquote></body></html>