falkaholic Posted February 27, 2002 Posted February 27, 2002 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.
ASNL Posted February 27, 2002 Posted February 27, 2002 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 ]
falkaholic Posted February 27, 2002 Author Posted February 27, 2002 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.
BobWeaver Posted February 27, 2002 Posted February 27, 2002 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.
RussBaker Posted February 27, 2002 Posted February 27, 2002 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
falkaholic Posted February 27, 2002 Author Posted February 27, 2002 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?
falkaholic Posted February 27, 2002 Author Posted February 27, 2002 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)
Recommended Posts
This topic is 8396 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now