Jdawg Posted October 21, 2005 Posted October 21, 2005 Hello, I'd like to send a selected portal row's data to a field on another layout. Schema: 2 layouts ; 2 windows. Relationships: Table:Department Field:"Department" linked to: Table:Course on field: "Department" ------------------- Table:Student field:"special rec" linked to: Table:Course on field:"CourseID" The field "special rec" in the Student table is empty and waiting to be filled by a selected course. On the student layout, a button is clicked to pull up a window containing a layout which displays the departments with their respective courses in a portal. I then want to choose one of those courses in the portal and send the data to the "special rec" field on the Student layout. Any ideas? Thanks! Jonathan
-Queue- Posted October 21, 2005 Posted October 21, 2005 You could use a script parameter for the desired data on the button which selects the course (just use PortalRelationship::Field as your parameter). Then the script can close the window or select the original one and then Set Field [student::special rec; Get(ScriptParameter)].
Sanjai Posted October 21, 2005 Posted October 21, 2005 It is often that the relationship between course and student table is many to many. One student can join multiple courses and one course can be joined by multiple students. Hence I would advise you to keep a separate table studentcourse to store the student and course details.
Jdawg Posted October 24, 2005 Author Posted October 24, 2005 (edited) Thank you, I feel like I'm getting somewhere. But I have a follow up question. I'm trying to build a script that will populate the two foreign key fields of the middle table (StudentCourse). So far it's creating a new record, but the data isn't showing up. I want the script to populate the StudentID from the Student table and the CourseID from the course table. On pages 456 and 457 in the book, "Special Edition Using Filemaker 7" by Lane, Bowers, Love, and Moyer there seems to be an example modeling what I'm trying to do. However, I think my problem is knowing how to refer to the various windows and layouts that are involved during the script. The studentID that I need is on the origional layout before I press a button to pop up a window containing the selection portal of courses. - Jonathan Edited October 24, 2005 by Guest
Sanjai Posted October 25, 2005 Posted October 25, 2005 Why not create the record directly in studentcourse table instead of creating record in another table and running the script to populate foreign key values in the new record? I don't know about your solution but usually in a school database which I would design, I would give a layout from a table to enter a new student information, another layout from another table to enter the course information and would have a layout from studentcourse table. I would have a portal row to show all the courses a student is attending. When an existing student comes to me, I would search his name in the studentcourse table which would show me all the courses he has applied to. If he wants to appear in anyother course, I would select the last row of the portal and select the course. In the portal, the field course would be a pop-up list based on the course field in course table. If you want to do it with the script, can you write to me where the data isn't showing?
Recommended Posts
This topic is 6969 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