Newbies jacq Posted March 7, 2009 Newbies Posted March 7, 2009 As a relative newcomer to FileMaker, I'm having problems with the Perform Find command. Having read a number of posts on this topic, my understanding is that you effectively have to use the Set Field command to store the variable, because FM can’t deal with $vars in the Perform Find command. However, I’m obviously missing something very basic (or I'm merely being very stupid) as I don’t understand what, if any, parameters you should then use in the Perform Find command. I’m trying to write a script that will create an attendance record from two other tables Courses and Course_Lessons. The new record would be stored in a table called Attendance. Courses has details of a course, Course_Lessons has lesson details and is a related table on field FKey Course and Attendance is related to Course_Lessons via field Fkey Lessons. The script would ideally find every lesson in the Course_Lessons table relating to one particular course. Effectively, a Perform Find statement within some sort of loop structure. The course id is passed to the Perform Find command via a variable. Any help just to sort out this problem would be greatly appreciated. Jacqu
Fenton Posted March 7, 2009 Posted March 7, 2009 Yes, putting the parameters in a 1-step Perform Find (or Constrain Find) can sometimes be a PITA (in my opinion). I usually use the Set Field approach, even though it is more steps. In that case you just uncheck [ ] Specify find requests (in the Perform Find). Another reason I like the Set Field approach is that it is self-documenting. Though I suppose there is also something to be said for brevity. That's why we have both methods. For what you want to do however I think I would use a relationship and Go To Related Record, in Browse mode. If you have the relationship you might well use it. It is best practice to make sure the relationship has records first, using: If [ not IsEmpty (relationship::id) Go To Related Record [ relationship; layout ] End If I don't really see what you're doing however. If you are creating a bunch of basically "blank" attendance records, to mark as "attended" later, then a good method is to gather all the related IDs into a $variable using: List (relationship::id) Then loop thru the multi-line variable with a counter, creating the attendance records for each.
bcooney Posted March 7, 2009 Posted March 7, 2009 Seems as if you're missing Students. Attendance is usually a join table btw Courses and Students.
comment Posted March 7, 2009 Posted March 7, 2009 The script would ideally find every lesson in the Course_Lessons table relating to one particular course. This is best accomplished by calling the Go to Related Record[] script step, with the option 'Show only related records'.
Newbies jacq Posted March 9, 2009 Author Newbies Posted March 9, 2009 Thanks, everybody. I used GTRR and it worked a treat. Problem solved. Jacq
Recommended Posts
This topic is 5739 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