>From any of the records in a linked iterator you can call _getParent(). This will return the record sitting between your parent object and your child object. IE: Attendee_Session.
>From there, you're golden! Doug -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wayne Graham Sent: Friday, July 14, 2006 10:25 AM To: [email protected] Subject: Re: [Reactor for CF] link _and_ relate to a join/junction table? I ran into a situation similar to this. I couldn't find anything to accomplish getting the other fields from pre-built reactor functions (and I didn't want to write any SQL in this particular instance). What I ended up doing was creating two query iterators and then merging the query with queryMerge from cflib (http://www.cflib.org/udf.cfm?ID=1021). The resulting code would look something like this: <cfset attendee_sessions = session.getAttendee_SessionIterator().getQuery() /> <cfset attendees = session.getAttendeeIterator().getQuery() /> <cfset newQuery = queryMerge(attendee_sessions, attendees, "attendee_id") /> You could also add a new function in the gateway to get the information out the way you want it, but I couldn't find a pre-built function get additional fields from the link table. HTH, Wayne Barry Beattie wrote: > I have a join/junction table between two others. pretty > straightforward except that the join table has additional fields, one > of which is another foreign key (1-M, actually) to another table. > > can I have a link _and_ a relate using that join table? > > thanx > barry.b > > <object name="Session_option"> > <hasMany name="Attendee"> > <link name="Attendee_Session" /><!-- to the join table --> > </hasMany> > <hasMany name="Attendee_Session"> > <relate from="Attendee_Session_id" to="Attendee_Session_id" > /><!-- to the join table --> > </hasMany> > </object> > > > <!-- THE JOIN/JUNCTION TABLE --> > <object name="Attendee_Session"> > <hasOne name="Session_option"> > <relate from="Session_option_id" to="Session_option_id" /> > </hasOne> > <hasOne name="Attendee"> > <relate from="Attendee_id" to="Attendee_id" /> > </hasOne> > </object> > > > <object name="Attendee"> > <hasMany name="Session_option"> > <link name="Attendee_Session" /><!-- to the join table --> > </hasMany> > <hasMany name="Attendee_Session"> > <relate from="Attendee_Session_id" to="Attendee_Session_id" > /><!-- to the join table --> > </hasMany> > </object> > > > ************************************ > > [PK: primary key; FK: foreign key; (FK): irrelevant foreign key] > > session_option > ---------------- > PK session_option_id > venue_id > session_start > session_end > (FK) session_id > > > attendee_session (alternative) > ---------------- > PK attendee_session_id > FK attendee_id > FK session_option_id > attended > (FK) attendee_session_comment_id > > > attendee > --------------- > PK attendee_id > user_id > attendee_contact > > ************************************ > > > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > -- -- -- > Reactor for ColdFusion Mailing List > [email protected] > Archives at: 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/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
