@Brian,
I would also prefer to use a gateway but how do I tell the createGateway
method to join the web_church_posts and xref_church_post_types table? Or
do I need to write a custom gateway query?
Pre-reactor I would just write:
SELECT xCP.Church_Post_Desc,wcp.Firstnames
FROM web_church_posts wcp, xref_church_post_types xCP
WHERE wcp.Church_Post_Type_id = xCP.Church_Post_Type_ID
ORDER BY xCP.Church_Post_Desc
@Chris,
Thanks for the order by syntax. This breaks the conditional loop
hasMore() method. Do I specify this within the loop?
Cheers,
Dave
Brian Kotek wrote:
You can call getQuery() on the iterator to return the underlying query.
If you need to sort or do other things though, I would call the gateway
for the other table and pass in whatever criteria (foreign key id or
sorting) you need. However you can do this directly through the iterator
if you really want to, using the Order object. Personally I think going
that route makes things start to get ugly pretty fast. I've never quite
understood why some folks want to do everything using the OO query
syntax, as to me it quickly gets cumbersome and would have been easier
just to call the gateway with a few simple arguments. Either way should
work though.
On 8/9/07, *Dave Phipps* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Hi,
I have 2 tables in the db: web_church_posts and xref_church_post_types
In my reactor.xml file I have setup this relationship:
<object name="web_church_posts">
<hasOne name="xref_church_post_types">
<relate from="Church_Post_Type_ID" to="Church_Post_Type_id"/>
</hasOne>
</object>
<object name="xref_church_post_types">
<hasOne name="web_church_posts">
<relate from="Church_Post_Type_id" to="Church_Post_Type_ID"/>
</hasOne>
</object>
I need to output in a table the following:
Church_Post_Desc (from xref_church_post_types)
FirstName,Lastname etc (from web_church_posts)
I have initially set up an iterator:
<set name="chPostsRecord"
value="#chRecord.getweb_church_postsIterator()#" />
and then I am looping through this. This is producing the results in an
unsorted order.
My question is: Is there a better way to do this using a query instead
of an iterator, if not how do I sort the iterator loop to display the
Church_Post_Desc in the proper order?
Any help, would be greatly appreciated.
Cheers,
Dave
--
David Phipps, Director
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
Chapel Studios / London
T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7765 240899
New Broad Street House, 35 New Broad Street, London, EC2M 1NH, United
Kingdom
Visit our website: http://www.chapel-studios.co.uk
_____________________________________________________________________________
Chapel Studios is a limited company registered in England. The
information in this email is confidential, intended solely for the
addressee, and may be legally privileged. If you are not the addressee
or authorized to receive this for the addressee, you must not use,
copy,
disclose or take any action based upon this message or any information
herein. If you have received this message in error, please advise
the sender immediately by reply e-mail.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
<http://www.mail-archive.com/reactor%40doughughes.net/>
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- --
--
David Phipps, Director
[EMAIL PROTECTED]
Chapel Studios / London
T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7765 240899
New Broad Street House, 35 New Broad Street, London, EC2M 1NH, United
Kingdom
Visit our website: http://www.chapel-studios.co.uk
_____________________________________________________________________________
Chapel Studios is a limited company registered in England. The
information in this email is confidential, intended solely for the
addressee, and may be legally privileged. If you are not the addressee
or authorized to receive this for the addressee, you must not use, copy,
disclose or take any action based upon this message or any information
herein. If you have received this message in error, please advise
the sender immediately by reply e-mail.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --