Introduction to Relation Fields

I added relation fields to DataMgr in version 2.0. Upon receiving a question about them by email, I noticed that I haven't ever written a good introduction about how to use them (though I have mentioned them several times).

[More]

Related Blog Entries

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Will dataMgr support the new "lite" database that ships with CF8?
# Posted By John Farrar | 7/31/07 3:06 PM
John,

Not yet, but thanks for the reminder.

I have a local test of Derby support running, but I haven't tested it against the final release or cleaned it up (facing a deadline at the moment). I hope to finish it up and have it out in beta soon.
# Posted By Steve Bryant | 7/31/07 3:25 PM
Steve, I'm here to give you kudos! Thanks for your time with DataMgr. DataMgr is a time saver and code saver for our applications. Cheers.
# Posted By Marco Antonio | 7/31/07 9:36 PM
Thanks Marco Antonio!
# Posted By Steve Bryant | 8/1/07 2:12 PM
While I've been enjoying learning SQL, I'm amazed by what DataMgr does and am now using it to convert a site to it. However, I also want to now add a feature to my site and want to know if this is possible using DataMgr. Any suggestions would be appreciated.

I'm using a join table, "Products_Pages", for a content management feature, where multiple Products can appear on multiple Pages within the site. I would like to also store Sort Order so that we can control the order that Products appear on a particular Page. Is this possible using DataMgr?

PageID   ProductID   Sorter
1   22      1
1   34      3
1   24      2
2   22      2
2   9      3
2   16      1

My tests to insert the Sort order to this join table, with its combined primary key, using 'updateRecord' and 'saveRelationList', resulted in errors.
# Posted By Steve Spellman | 9/14/07 9:14 PM
Steve,

Great question. I don't have a relation field set up to handle sorting in exactly the way that you want (though that is certainly a feature worth exploring).

I do, however, have a saveSortOrder method that should do what you want. Here is a link to the documentation for the method as well as to a video presentation I made a while back about its use.

http://www.bryantwebconsulting.com/cfcs/DataMgr2.h...
http://steve.coldfusionjournal.com/datamgrsort.htm...

Let me know if you have any more questions or suggestions.
# Posted By Steve Bryant | 9/15/07 12:59 PM
Hi Steve, maybe just one more question...

The 'saveSortOrder' method gives me the error message below:
"This method can only be used on tables with exactly one primary key field."

Do you have any suggestions on how I could continue to make use of the 'SaveRelationList' method (which requires the two-field primary key) for this join table, yet still add a sort feature for the site user. A separate web page would be okay, I'd just like to use DataMgr for it if possible. Thanks!
# Posted By Steve Spellman | 9/15/07 11:54 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.