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).
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.
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.
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.
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!