mleiser Posted December 30, 2012 Posted December 30, 2012 I'm embarrassed to even ask this question but here goes. I'm sure I'm doing this the hard way. Simply put we have a parent table and a student table. The primary key (parent id) points to the foreign key (parent id) in the student record. I can now have a list by parent with all their children. Fine. Now I want a list of parents with any children they may have in 7th and 8th grade. What I did (please don't laugh) is create a primary key in parents with the parent id concatenated with a "Y". In the student record, if the student is in the 7th or 8th grade I create a foreign key with parent id concatenated with a "Y". I create an occurence in my relationships that have the parent table connected to the student table with this new key. So now in my report I get, for each parent, any students that are in 7th or 8th grade. Problem is I get every parent - some with no students of course. But what I want is ONLY those parents with students in those 2 grades. So I narrow it down in a script. In any event, I just know the way I'm doing it is wrong. It's gotta be much easier. Any help? Thanks
comment Posted December 30, 2012 Posted December 30, 2012 In order to show a list of parents that have children in 7th or in 8th grade, you need to perform a find in the Parent table. If scripted, the find would look something like: Go to Layout [ Parent ] Enter Find Mode [ ] Set Field [ Student::Grade ; 7 ] New Record/Request Set Field [ Student::Grade ; 8 ] Perform Find [ ]
mleiser Posted December 30, 2012 Author Posted December 30, 2012 That I know. What I'm trying to understand is how you use occurrences to get to a subset of records without doing the above. If I do the above I never have to have an additional occurrence of a table. Just do intricate finds. Isn't that the purpose of these occurrences? Not to have to do that? As another example, I set up an occurrence for just elementary students and one for just high school students. they work nice but I get every parent with blank info if they're not from the appropriate category. Am I making any sense to anybody?
bruceR Posted December 30, 2012 Posted December 30, 2012 There are quite a few problems and misconceptions with your direction. 1. No, that is NOT the purpose of table occurrences. 2. Even where table occurrences produce a filtered set of records, you must either use a portal; or go to related record operation to arrive at the subset of records you are looking for. 3. It isn't clear why you perceive complex finds as problematic. If you need to specify detailed criteria to establish a particular record set; then you need to specify detailed criteria to establish a particular record set. Why is writing a find script a problem? 4. Find scripts can be sequenced and fine-tuned. For example, find all parents of 7th and 8th graders. Then find the subset where the student attendance record is poor. 5. It is not at all clear what your last sentence means. This involves a list view layout? A portal? How is it that the blank info is displayed? 6. Even where you are creating a filtered relationship or filtered portal, there are more generic ways to control the filter so that you don't have to create new table occurrences for each intended filter. You don't need to create a 7th grade TO; 8th grade TO; 7th and 8th grade TO; high school TO; etc. For example you can use a global field as part of the relationship and use a checkbox to specify one or more grades. It would be a good idea to create a version of your file with dummy data and post it. There are a thousand ways you could be mis-perceiving things and it is much easier to help if we see what you are actually doing.
comment Posted December 30, 2012 Posted December 30, 2012 If I do the above I never have to have an additional occurrence of a table. Just do intricate finds. Isn't that the purpose of these occurrences? Not to have to do that? Well, that's one way to look at it. The other is that the purpose of finds - intricate or not - is to eliminate table occurrences. It really depends on what are you doing, though IMHO whenever you can get away with less TOs, go for it. In any case, if you prefer to use a relationship to filter records, you will need to use a portal to show the related set. A layout of any TO is capable of showing any and all records of the underlying table and you need to perform find or GTRR in order to control the found set.
mleiser Posted December 30, 2012 Author Posted December 30, 2012 Thank you both for your responses. I have to go back to the drawing board to understand table occurrences better. I have no problem with the find scenario. I do it all the time. I just thought I was doing it wrong. Thanks again.
bruceR Posted December 31, 2012 Posted December 31, 2012 I still suggest posting a copy of your file, with dummy data.
Recommended Posts
This topic is 4406 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