<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? &nbsp;(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 &lt;<a href="mailto:ksmclane@us.ibm.com">ksmclane@us.ibm.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div><tt><font size="2"><br>
&gt; your code will only work for fields in the main table of your resultset,<br>
&gt; but will break for relations. for example,<br>
&gt; $data-&gt;department.department_code is not a valid accessor. you
will have<br>
&gt; to parse your field definition and convert it into<br>
&gt; $data-&gt;department-&gt;department_code in order to retrieve the
data.<br>
&gt; <br>
&gt; HTH<br>
&gt; <br>
&gt; &nbsp; &nbsp; patrick<br>
&gt; <br>
&gt; -- <br>
&gt; Patrick Meidl ........................ <a href="mailto:patrick@pantheon.at">patrick@pantheon.at</a><br>
&gt; 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">&nbsp; &nbsp; &nbsp; &nbsp; foreach my $field
(@fields) {</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; $ws-&gt;write($row, $col, $field);</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; $col++;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; }</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; $col=0;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; $row++;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; while (my @data
=$sr-&gt;next) {</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; foreach my $data (@data) {</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach my $field
(@fields) {</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; if ($field =~ /\./) {</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $field = join(
"-&gt;", split( /\./, $field));</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; }</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; $ws-&gt;write($row, $col, $data-&gt;$field);</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; $col++;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $col=0;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; $row++;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; }</font></tt>
<br><tt><font size="2">Which gives this error:</font></tt>
<br><tt><font size="2">Caught exception in dbms::Controller::AccountView-&gt;list
"Can't locate object method "department-&gt;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 "-&gt;"
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>