Current Record: Getting related records #67

News

Current Record: Getting related records #67

News

Click to minimize this section Details

News id 67
Headline Getting related records
Content One thing you'll want to do is to grab related records in Xataface. Say for example, you have an abstract record that belongs to a conference. In the relationships.ini file of your abstract table, you would include something like this:br /br /blockquotebr /[Conference]br /conference.ConferenceID="$AbstractConferenceID"br //blockquotebr /br /Where the conference is the name of the conference table, ConferenceID is the name of the index of that table, and $AbstractConferenceID is the foreign ID in your abstract record that corresponds to the the particular record in the conference table. Note the name of the relationship is "Conference."br /br /In Xataface, if you have an abstract record you can quickly retrieve the related conference by simply doing this:br /br /blockquotebr /$conference = $record-getRelatedRecord('Conference')br //blockquotebr /br /This will retrieve the conference as a xataface_related_record object. It is important to realize that this is not the same thing as a xataface_record. If you want to convert this related_record object into a xataface_record object you can use the toRecord() function:br /br /blockquote$conference = $record-getRelatedRecord('Conference')-toRecord();/blockquotebr /br /This is a powerful technique that can save a lot of time.
Image (Empty)
Date posted Tue Dec 16 15:38:00 2008
Posted by noreply@blogger.com (Fong Chun Chan)
Status Approved
Categories Blog
Source id Fong's Blog
Source url http://fongxataface.blogspot.com/2008/12/getting-related-records.html
Powered by Xataface
(c) 2005-2024 All rights reserved