<font size=2 face="sans-serif">To answer my own question, yes I can use
&quot;get_column&quot; in a TT file. Thanks for all the help. Not only
is it working but fixing the prefetch cut my processing time in half serving
the page.</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">From:</font>
<td><font size=1 face="sans-serif">Alexander Hartmaier &lt;alexander.hartmaier@t-systems.at&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">To:</font>
<td><font size=1 face="sans-serif">&lt;catalyst@lists.scsys.co.uk&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Date:</font>
<td><font size=1 face="sans-serif">05/08/2012 11:07 AM</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Subject:</font>
<td><font size=1 face="sans-serif">Re: [Catalyst] Getting hashref instead
of value</font></table>
<br>
<hr noshade>
<br>
<br>
<br><font size=3>Am 2012-05-08 17:46, schrieb Kenneth S Mclane: </font>
<br><font size=2 face="sans-serif">In checking through docs on line I find
that prefetch is a better way to go so I have changed ny sub thusly:</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
sub list :Local {</font><font size=3> </font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;my ($self, $c, $page) = @_;</font><font size=3>
</font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;$page = $c-&gt;req-&gt;param('page') || 1;</font><font size=3>
</font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;my $rs = $c-&gt;model('ORANGES::Account')-&gt;search({},
{ <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;prefetch =&gt;
'progress',</font><font size=3> </font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;prefetch =&gt;
'compliance',</font><font size=3> </font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;prefetch =&gt;
'department_id',</font><font size=3> </font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;prefetch =&gt;
'metrics',</font><font size=3> </font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;order_by =&gt;
'account_code',</font><font size=3> </font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rows =&gt; 15,</font><font size=3>
</font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;page =&gt; $page,</font><font size=3>
</font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp; });</font><font size=3> </font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;$c-&gt;stash(accounts =&gt; $rs);</font><font size=3>
</font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;$c-&gt;stash(pager =&gt; $rs-&gt;pager());</font><font size=3>
</font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;$c-&gt;stash-&gt;{'template'}=&gt;'accountview/list';</font><font size=3>
</font><font size=2 face="sans-serif"><br>
}</font><font size=3> </font>
<br><font size=3>{} is a hashref in Perl. You're defining four values for
the key 'prefetch', the last one overwrites the three previous ones.<br>
As already noted you need to specify the prefetch value as arrayref in
your case:<br>
prefetch =&gt; [qw( progress compliance department_id metrics )],<br>
FYI: qw() does nothing but saving you to quote every element of the list.
It's equal to<br>
prefetch =&gt; ['progress', 'compliance', 'department_id', 'metrics'],<br>
<br>
Note that this is all basic Perl and nothing specific of Catalyst or DBIx::Class.</font>
<br><font size=3><br>
</font>
<table width=100%>
<tr valign=top>
<td width=17%><font size=1 color=#5f5f5f face="sans-serif">From:</font><font size=3>
</font>
<td width=82%><font size=1 face="sans-serif">Frank Schwach </font><a href=mailto:fs5@sanger.ac.uk><font size=1 color=blue face="sans-serif"><u>&lt;fs5@sanger.ac.uk&gt;</u></font></a><font size=3>
</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">To:</font><font size=3>
</font>
<td><a href=mailto:catalyst@lists.scsys.co.uk><font size=1 color=blue face="sans-serif"><u>catalyst@lists.scsys.co.uk</u></font></a><font size=3>
</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Date:</font><font size=3>
</font>
<td><font size=1 face="sans-serif">05/08/2012 10:36 AM</font><font size=3>
</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Subject:</font><font size=3>
</font>
<td><font size=1 face="sans-serif">Re: [Catalyst] Getting hashref instead
of value</font></table>
<br><font size=3><br>
</font>
<hr noshade><font size=3><br>
<br>
</font><tt><font size=2><br>
not sure if this is a problem but you should also collapse your joins,
<br>
selects and as' into ArrayRefs, as in<br>
join =&gt; [ qw( progress compliance department_id ...)]<br>
<br>
actually the last one looks suspicious. the relationships should be <br>
called something like &quot;departments&quot;, not department_ids. If you
have the <br>
same naming for accounts then an account_id is the name (presumably) of
<br>
a field in accounts and also a relationship<br>
Frank<br>
<br>
<br>
On 08/05/12 16:25, Steve wrote:<br>
&gt; The 'account.account_id' referenced in your template I believe is
being<br>
&gt; interpreted as an object. Try 'account.account_id.id' instead. I am<br>
&gt; presuming that your DBIC relationship is called 'account_id', and
that<br>
&gt; is what you are referencing currently in your template.<br>
&gt;<br>
&gt; On 5/8/2012 11:13 AM, Kenneth S Mclane wrote:<br>
&gt;&gt; I am having a problem with my code and I cannot figure out why
it is<br>
&gt;&gt; doing what it is doing. I have this sub:<br>
&gt;&gt;<br>
&gt;&gt; sub list :Local {<br>
&gt;&gt; my ($self, $c, $page) = @_;<br>
&gt;&gt; $page = $c-&gt;req-&gt;param('page') || 1;<br>
&gt;&gt; my $rs = $c-&gt;model('ORANGES::Account')-&gt;search({}, {<br>
&gt;&gt; join =&gt; 'progress',<br>
&gt;&gt; '+select' =&gt; ['progress.percent_complete'],<br>
&gt;&gt; '+as' =&gt; ['progress.percent_complete'],<br>
&gt;&gt; join =&gt; 'compliance',<br>
&gt;&gt; '+select' =&gt; ['compliance.percent_compliant'],<br>
&gt;&gt; '+as' =&gt; ['compliance.percent_compliant'],<br>
&gt;&gt; join =&gt; 'department_id',<br>
&gt;&gt; '+select' =&gt; ['department_id.department_id'],<br>
&gt;&gt; '+as' =&gt; ['department_id.department_id'],<br>
&gt;&gt; join =&gt; 'metrics',<br>
&gt;&gt; '+select' =&gt; ['metrics.num_servers','metrics.num_subsystems'],<br>
&gt;&gt; '+as' =&gt; ['metrics.num_servers','metrics.num_subsystems'],<br>
&gt;&gt; order_by =&gt; 'account_code',<br>
&gt;&gt; rows =&gt; 15,<br>
&gt;&gt; page =&gt; $page,<br>
&gt;&gt; });<br>
&gt;&gt; $c-&gt;stash(accounts =&gt; $rs);<br>
&gt;&gt; $c-&gt;stash(pager =&gt; $rs-&gt;pager());<br>
&gt;&gt; $c-&gt;stash-&gt;{'template'}=&gt;'accountview/list';<br>
&gt;&gt;<br>
&gt;&gt; }<br>
&gt;&gt; Which I have tried in several different ways to fix this problem,
but<br>
&gt;&gt; none have worked so far. In my template file all my fields come
up<br>
&gt;&gt; with the valyes expected, except, I am trying to use the account_id<br>
&gt;&gt; field value as part of a uri to take the user to a details page
for<br>
&gt;&gt; the row. Where I am expecting a uri such as<br>
&gt;&gt; '</font></tt><a href=http://127.0.0.1:3000/accountdetails/detail/170><tt><font size=2 color=blue><u>http://127.0.0.1:3000/accountdetails/detail/170</u></font></tt></a><tt><font size=2>'<br>
&gt;&gt; I instead get a uri like this:<br>
&gt;&gt;<br>
&gt;&gt; </font></tt><a href="http://127.0.0.1:3000/accountdetails/detail/dbms::Model::ORANGES::Account=HASH%280x5496460%29"><tt><font size=2 color=blue><u>http://127.0.0.1:3000/accountdetails/detail/dbms::Model::ORANGES::Account=HASH%280x5496460%29</u></font></tt></a><tt><font size=2><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; This used to work when I was using a view as the basis for my
list page.<br>
&gt;&gt;<br>
&gt;&gt; When I run the page I can see in the sub-queries that it runs
that it<br>
&gt;&gt; has the &quot;account_id&quot; value as it uses it, but when I
try to access it<br>
&gt;&gt; in my template I get the hash ref. None of the other fields do
this.<br>
&gt;&gt;<br>
&gt;&gt; one of the sub queries using the account_id value:<br>
&gt;&gt; SELECT me.account_id, me.account_code, me.percent_compliant FROM<br>
&gt;&gt; HCDB_TEST.COMPLIANCE me WHERE ( me.account_id = ? ): '321'<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; My template that cretaes the uri:<br>
&gt;&gt;<br>
&gt;&gt; &lt;td&gt;&lt;a href=&quot;[% c.uri_for('/accountdetails/detail/')
%][%<br>
&gt;&gt; account.account_id %]&quot;&gt;[% account.account_code %]&lt;/a&gt;&lt;/td&gt;<br>
&gt;&gt;<br>
&gt;&gt; If someone could point me in the right direction, Ive been fighting<br>
&gt;&gt; this for days.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; List: </font></tt><a href=mailto:Catalyst@lists.scsys.co.uk><tt><font size=2 color=blue><u>Catalyst@lists.scsys.co.uk</u></font></tt></a><tt><font size=2><br>
&gt;&gt; Listinfo: </font></tt><a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"><tt><font size=2 color=blue><u>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</u></font></tt></a><tt><font size=2><br>
&gt;&gt; Searchable archive:<br>
&gt;&gt; </font></tt><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"><tt><font size=2 color=blue><u>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</u></font></tt></a><tt><font size=2><br>
&gt;&gt; Dev site: </font></tt><a href=http://dev.catalyst.perl.org/><tt><font size=2 color=blue><u>http://dev.catalyst.perl.org/</u></font></tt></a><tt><font size=2><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; List: </font></tt><a href=mailto:Catalyst@lists.scsys.co.uk><tt><font size=2 color=blue><u>Catalyst@lists.scsys.co.uk</u></font></tt></a><tt><font size=2><br>
&gt; Listinfo: </font></tt><a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"><tt><font size=2 color=blue><u>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</u></font></tt></a><tt><font size=2><br>
&gt; Searchable archive: </font></tt><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"><tt><font size=2 color=blue><u>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</u></font></tt></a><tt><font size=2><br>
&gt; Dev site: </font></tt><a href=http://dev.catalyst.perl.org/><tt><font size=2 color=blue><u>http://dev.catalyst.perl.org/</u></font></tt></a><tt><font size=2><br>
<br>
<br>
-- <br>
The Wellcome Trust Sanger Institute is operated by Genome Research <br>
Limited, a charity registered in England with number 1021457 and a <br>
company registered in England with number 2742969, whose registered <br>
office is 215 Euston Road, London, NW1 2BE. <br>
<br>
_______________________________________________<br>
List: </font></tt><a href=mailto:Catalyst@lists.scsys.co.uk><tt><font size=2 color=blue><u>Catalyst@lists.scsys.co.uk</u></font></tt></a><tt><font size=2><br>
Listinfo: </font></tt><a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"><tt><font size=2 color=blue><u>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</u></font></tt></a><tt><font size=2><br>
Searchable archive: </font></tt><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"><tt><font size=2 color=blue><u>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</u></font></tt></a><tt><font size=2><br>
Dev site: </font></tt><a href=http://dev.catalyst.perl.org/><tt><font size=2 color=blue><u>http://dev.catalyst.perl.org/</u></font></tt></a><tt><font size=2><br>
</font></tt><font size=3><br>
<br>
<br>
<br>
</font>
<br><tt><font size=3>_______________________________________________<br>
List: </font></tt><a href=mailto:Catalyst@lists.scsys.co.uk><tt><font size=3 color=blue><u>Catalyst@lists.scsys.co.uk</u></font></tt></a><tt><font size=3><br>
Listinfo: </font></tt><a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"><tt><font size=3 color=blue><u>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</u></font></tt></a><tt><font size=3><br>
Searchable archive: </font></tt><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"><tt><font size=3 color=blue><u>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</u></font></tt></a><tt><font size=3><br>
Dev site: </font></tt><a href=http://dev.catalyst.perl.org/><tt><font size=3 color=blue><u>http://dev.catalyst.perl.org/</u></font></tt></a><tt><font size=3><br>
</font></tt>
<br><font size=2 color=#800080 face="Verdana"><br>
<br>
*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*<br>
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien<br>
Handelsgericht Wien, FN 79340b<br>
*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*<br>
Notice: This e-mail contains information that is confidential and may be
privileged.<br>
If you are not the intended recipient, please notify the sender and then<br>
delete this e-mail immediately.<br>
*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*</font><tt><font size=2>_______________________________________________<br>
List: Catalyst@lists.scsys.co.uk<br>
Listinfo: </font></tt><a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"><tt><font size=2>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</font></tt></a><tt><font size=2><br>
Searchable archive: </font></tt><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"><tt><font size=2>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</font></tt></a><tt><font size=2><br>
Dev site: </font></tt><a href=http://dev.catalyst.perl.org/><tt><font size=2>http://dev.catalyst.perl.org/</font></tt></a><tt><font size=2><br>
</font></tt>
<br>
<br>