On Wednesday 10 November 2004 11:32 am, Jason Gottshall wrote:
> > [% FOREACH logentry = DBI.query("SELECT * FROM altpower_battery_log_tb
> >                                     WHERE  (project_code = "[%
>
> item_code %]"
>
> >                                             )
> >                                 ")%]
>
> You can't embed TT tags inside each other like that. What you want is to
> interpolate a variable into your double-quoted string, like so:
>
> [% FOREACH logentry = DBI.query("SELECT * FROM altpower_battery_log_tb
>                                       WHERE  (project_code =
> $item_code
>                                               )
>                                   ")%]

Thanks for the responce I did the above just after sending the message as part 
of my persistent need to hack.

> This can actually be done without putting the field value into a
> temporary value, like this:
>
> [% FOREACH logentry = DBI.query("SELECT * FROM altpower_battery_log_tb
>                                       WHERE  (project_code =
> ${item.item_code}
>                                               )
>                                   ")%]
>

I would not have thought of this IE the { }. 

I have gotten the code to work to a point but there is a problem

There are 4 items in my test log table.

Code logic right now is a FOREACH within a FOREACH. The out side one has 4 
values that it call when used allown. When the in FOREACH is added the outer 
loop stops after the second pass. It should go 4. Any suggestions why this 
might happen.

Also should I really be looking to use a JOIN to get the The data out of the 
second table.?

The link to my testing is

http://computersystemconsulting.ca/cgi-bin/AltPower/altpower.cgi?site=AltPower&session_id=MKCFV66FI8HLVIQE&view=StatsView

-- 
Thanks
Shanta McBain
Http://computersystemconsulting.ca Web hosting and Application Hosting.

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to