<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">Hernan Lopes &lt;hernanlopes@gmail.com&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">To:</font>
<td><font size=1 face="sans-serif">The elegant MVC web framework &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">04/05/2012 06:18 PM</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Subject:</font>
<td><font size=1 face="sans-serif">Re: [Catalyst] Datagrid with details
view?</font></table>
<br>
<hr noshade>
<br><font size=2 face="sans-serif">This is my first attempt. I did get
it working, I am using this as a learning exercise. You have given me several
different things to try for this as alternatives. &nbsp;Please see my comments/answers
inline below.</font>
<br>
<br><font size=3>Kenneth,&nbsp;</font>
<br><font size=3>you are using -&gt;search which return multiple records,
and you are using [% details.account_code %] &nbsp;on your code. Maybe
you should:</font>
<br><font size=3>1. [% details.0.account_code %] and -&gt;all </font>
<br><font size=3>or 2. while ( $item = $results-&gt;next ) { ... }</font>
<br><font size=3>Kenneth&gt; I used search as that was what I found an
example of, plus in my case it only returns one record. I ended up wrapping
my template code in a FOREACH and changing to a singular reference.</font>
<br><font size=3>and you can always do</font>
<br><font size=3>$results =&nbsp;$c-&gt;model('ORANGES::AccountDetails')-&gt;search({account_id
=&gt; {'=', \$acctid}})</font>
<br><font size=3>$c-&gt;stash(details =&gt; $results )</font>
<br><font size=3>instead of</font>
<br><font size=3>$c-&gt;stash(details =&gt; [$c-&gt;model('ORANGES::AccountDetails')-&gt;search({account_id
=&gt; {'=', \$acctid}})]);</font>
<br>
<br><font size=3>and, why are you using \$acctid ? why not simply $acctit?</font>
<br><font size=3>Kenneth&gt; the code did not want to accept it without
the escape for some reason, perhaps I needed to wrap it in double quotes.
It wasn't interpolating it.</font>
<br><font size=3>and why -&gt;search and not -&gt;find if its one record...
you need find</font>
<br><font size=3>Kenneth&gt; good to know. </font>
<br>
<br><font size=3>good luck</font>
<br>
<br><font size=3>-hernan</font>
<br>
<br>
<br><font size=3>On Thu, Apr 5, 2012 at 3:07 PM, Kenneth S Mclane &lt;</font><a href=mailto:ksmclane@us.ibm.com><font size=3 color=blue><u>ksmclane@us.ibm.com</u></font></a><font size=3>&gt;
wrote:</font>
<br><font size=3 face="sans-serif">I am trying to duplicate a .aspx website.
I have succeeded in getting a page based on a db view. In the original
site you can click on a row and a details view appears at the bottom of
the page. I don't know if this is possible, but I have been trying to simply
get a second page to come up with the details. I created a view with the
fields I need and re-created my schema. I created a controller and added
this code:</font><font size=3> <br>
</font><font size=3 face="sans-serif"><br>
sub detail :Local :Args(1) {</font><font size=3> </font><font size=3 face="sans-serif"><br>
&nbsp; &nbsp; my ($self, $c, $acctid) = @_;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&nbsp; &nbsp; $c-&gt;stash(details =&gt; [$c-&gt;model('ORANGES::AccountDetails')-&gt;search({account_id
=&gt; {'=', \$acctid}})]);</font><font size=3> </font><font size=3 face="sans-serif"><br>
&nbsp; &nbsp; $c-&gt;stash(template =&gt; 'accountdetails/detail.tt2');</font><font size=3>
</font><font size=3 face="sans-serif"><br>
}</font><font size=3> </font><font size=3 face="sans-serif"><br>
This appears to create a valid sql query, I get results when running it
directly on the db.</font><font size=3><br>
</font><font size=3 face="sans-serif"><br>
I added code to my list.tt2 file to create a link to the /accountdetails/detail
URI by wrapping one of my TD in an href statement like this:</font><font size=3>
<br>
</font><font size=3 face="sans-serif"><br>
&lt;td&gt;&lt;a href=&quot;[% c.uri_for('/accountdetails/detail/') %][%
account.account_id %]&quot;&gt;[% account.account_code %]&lt;/a&gt;&lt;/td&gt;</font><font size=3>
<br>
</font><font size=3 face="sans-serif"><br>
I created my detail.tt2 file containing this:</font><font size=3> <br>
</font><font size=3 face="sans-serif"><br>
[% META title = 'Account Detail' -%]</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;center&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;table border=&quot;1&quot; style=&quot;width:33%;border-collapse:collapse;&quot;&gt;</font><font size=3>
<br>
</font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:#F8F8F8;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Account Code&lt;/td&gt;&lt;td&gt;[%
details.account_code %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:White;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Account Name&lt;/td&gt;&lt;td&gt;[%
details.account_name %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:#F8F8F8;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Account Policy&lt;/td&gt;&lt;td&gt;[%
details.account_policy %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:White;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Account Target&lt;/td&gt;&lt;td&gt;[%
details.account_target %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:#F8F8F8;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Account Workitem&lt;/td&gt;&lt;td&gt;[%
details.account_workitem %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:White;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Start Date&lt;/td&gt;&lt;td&gt;[%
details.start_date %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:#F8F8F8;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Kit Date&lt;/td&gt;&lt;td&gt;[%
details.kit_date %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:White;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Upgrade Date&lt;/td&gt;&lt;td&gt;[%
details.upgrade_date %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:#F8F8F8;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Approval Date&lt;/td&gt;&lt;td&gt;[%
details.approval_date %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:White;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Sunset Date&lt;/td&gt;&lt;td&gt;[%
details.sunset_date %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:#F8F8F8;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Alert Flag&lt;/td&gt;&lt;td&gt;[%
details.alert_flag %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:White;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Cirats Flag&lt;/td&gt;&lt;td&gt;[%
details.cirats_flag %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:#F8F8F8;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Report Flag&lt;/td&gt;&lt;td&gt;[%
details.report_flag %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:White;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Sample Flag&lt;/td&gt;&lt;td&gt;[%
details.sample_flag %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:#F8F8F8;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Sample Rate&lt;/td&gt;&lt;td&gt;[%
details.sample_rate %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;tr style=&quot;backround-color:White;&quot;&gt;</font><font size=3>
</font><font size=3 face="sans-serif"><br>
&lt;td style=&quot;background-color:#E5ECF9;&quot;&gt;Department Code&lt;/td&gt;&lt;td&gt;[%
details.department_code %]&lt;/td&gt;&lt;/tr&gt;</font><font size=3> <br>
</font><font size=3 face="sans-serif"><br>
&lt;/table&gt;</font><font size=3> </font><font size=3 face="sans-serif"><br>
&lt;/center&gt;</font><font size=3> <br>
</font><font size=3 face="sans-serif"><br>
My link works, I get the detail page with all the formatting and the pre-populated
TD's, but the data is not showing up. I think I am missing something.</font><font size=3>
<br>
</font><font size=3 face="sans-serif"><br>
Once again all help is appreciated.</font><font size=3><br>
</font>
<br>
<br>