February 27, 200223 yr Can anyone tell me some of the uses of self-relations? (insert use your hand joke here) the whole topic has me a bit misty.
February 27, 200223 yr On a basic level, Lets say you have a single file DB with recipies. You could have a self relationship with a catagory field. So say you were in a particualar recipie with a catagory of casserole. You could have a portal using the self relationship and have it show all other recipies on file that were also casseroles. Another one that I've used, is create an Always_1 field that is equal to one on every record, create a self relationship using that field. Then you can create a portal that constantly shows all records in that file. I'm sure someone else here can give a better example, but I hope this helps. [ February 26, 2002, 04:30 PM: Message edited by: ASNL ]
February 27, 200223 yr Author thanks! i see now. thats a good usage/example. I was just getting mental block thinking used always use your primary key and they wouldn't be that useful.
February 27, 200223 yr Another popular use is to show totals or counts of like records. Using the previous example, you could have a calculated field with the formula: Count(TheSelfJoinRelatn::AnyField) which would show you how many records there are with the same key field (ie how many casserole recipes there are) or Sum(TheSelfJoinRelatn::Cups-O-Macaroni) which would tell you how many cups of macaroni, in total, you would need if you were going to cook every casserole in the database. Okay, this second example may not be terribly applicable in this case, but it does show you how you can use a self-join to summarize various fields in the related records.
February 27, 200223 yr I use them a lot in my mountain bike and triathlon timing systems for registering athletes. By creating a self relationship in my registration database, using the Entry Category as the key, when you allocate the athlete an Entry Category all the other athletes in that same category are shown in a portal. This way, you can easily see who else is entered in that category and also create useful features like automatically assigning the new athlete a race number which is 1 more than the number at the top of the portal (portal sorted by race number in decreasing order). This solves the most common questions at a live race registration... "Is Joe Bloggs in this category?" "How many other riders are in this category?" Russ Baker Canberra, Australia
February 27, 200223 yr Author thanks for some more ideas... i have another Q, it was suggested to be awhile ago to use self-relations instead of sub-summaries in preview mode. I didn't want to have to go into preview mode to have to view all the subsections. I can do it using portals with self-relations, but portals don't mix will with printing. Because some of the reports could be 2 rows or 300 rows, sometimes they will need more then one page. I there another clever way to print portals? Should i make a new reports database?
February 27, 200223 yr Author OK, Mr. Brain (aka Me) just realized that I should ust make one printable layout and one for viewing using self-relations. Duh. (NOTE: before mentioned mental block)
Create an account or sign in to comment