Steve,<br><br>I'm not sure, but you may not need a "join" to do what you're asking to do.<br><br><div><span class="gmail_quote">On 11/4/07, <b class="gmail_sendername">Steve H</b> <<a href="mailto:s_t_e_v_e_h@hotmail.com">
s_t_e_v_e_h@hotmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Hi again<br>(BTW, Andrew, thanks for your last help... I've been busy working with it and distracted by my next stumbling block).
<br>I've been puzzling over the manual and examples for how to express a simple join... I can't make sense of the Doxory example, for example, relating it to my simple context/example below.<br>I seem to be losing the plot with where/whether Alias's are required, where Type comes into it, why/where 'main' is used in various examples (although I've seen that Jifty appears to use 'main' as a default alias), etc, etc, ...I've tried many, many combinations, resulting in errors (from bin/jifty server) ranging from "Unsatisfied dependency chain in joins" through to garbled SQL being generated (that fails 'prepare'). Although I've been hand-coding SQL for years... I don't seem to be getting the hang of this abstraction from the Jifty docs sans examples.
<br>I created a simple app to indicate the issue per below. Some (code) fragments include:<br><br>sqlite3 DB, created via Jifty:<br>CREATE TABLE order_hdrs (<br> id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,<br> oh_deliv_addr text
<br>);<br>CREATE TABLE order_lines (<br> id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,<br> ol_oh_pk integer ,<br> ol_descr text ,<br> ol_qty integer<br>);<br><br>Example of a simple SQL join:<br>sqlite> select oh_deliv_addr, ol_descr, ol_qty from order_hdrs oh, order_lines ol where
<a href="http://ol.id">ol.id</a> = <a href="http://oh.id">oh.id</a>;<br>deliv addr1|descr1 for deliv1|1<br>deliv addr2|descr2 for deliv1|2</blockquote><div><br>You should be able to just iterate over order lines:<br><br>my $order_lines = MyTest::Model::OrderLineCollection->new;
<br># Add any limits you want here...<br>while (my $order_line = $order_lines->next) {<br> Jifty->web->out(join(' : ', $order_line->ol_oh_pk->oh_deliv_addr, $order_line->ol_descr, $order_line->ol_qtr), "\n");
<br>}<br><br>You could use a join to do this, but your test case makes it appear that just this code should do the job.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Example of a template/index.html to display via:<br> ol_descr ol_qty<br>% }<br><br></&><br><br>The Models used for this example include:<br>==> Model/OrderHdr.pm <==<br>use strict;<br>use warnings;<br>package MyTest::Model::OrderHdr;
<br>use Jifty::DBI::Schema;<br>use MyTest::Record schema {<br> column oh_deliv_addr =><br> type is 'text',<br> label is 'Delivery Address';<br> is mandatory,
<br> render_as 'Textarea';<br>};<br># Your model-specific methods go here.<br>1;<br><br>==> Model/OrderLine.pm <==<br>use strict;<br>use warnings;<br>package MyTest::Model::OrderLine;<br>use Jifty::DBI::Schema;
<br>use MyTest::Record schema {<br> column ol_oh_pk =><br> type is 'integer',<br> label is 'OrdrHdr PK',<br> refers_to MyTest::Model::OrderHdr by 'id';
<br> column ol_descr =><br> type is 'text',<br> label is 'Descr';<br> column ol_qty =><br> type is 'integer',<br> label is 'Qty';
<br>};<br># Your model-specific methods go here.<br>1;<br><br><br><br>_________________________________________________________________<br>Your Future Starts Here. Dream it? Then be it! Find it at <a href="http://www.seek.com.au">
www.seek.com.au</a><br><a href="http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2F%3Ftracking%3Dsk%3Ahet%3Ask%3Anine%3A0%3Ahot%3Atext&_t=764565661&_r=OCT07_endtext_Future&_m=EXT_______________________________________________">
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2F%3Ftracking%3Dsk%3Ahet%3Ask%3Anine%3A0%3Ahot%3Atext&_t=764565661&_r=OCT07_endtext_Future&_m=EXT_______________________________________________
</a><br>jifty-devel mailing list<br><a href="mailto:jifty-devel@lists.jifty.org">jifty-devel@lists.jifty.org</a><br><a href="http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel">http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
</a><br></blockquote></div><br>