bstrad Posted November 19, 2009 Posted November 19, 2009 So I'm trying to navigate between records to the appropriate layout. In my database I have different forms that students need to take and fill out. Which forms the students need to take is dependent on which classes they are in. So I have a Student table, a Enrollment table which relates which classes have which students and vice-versa, the Course table, and then the Forms Assignment table which only has two fields (course id and form name). The last table in my database is linked directly to the student and is the Forms table. This table contains all of the different forms a student can take and displays the different forms by using different layouts. From the student table/layout I have setup a portal that shows me the related records from the form assignment table using the form name field. This portal is working properly and displaying the correct form names. Now I want to put a link inside the row in the portal displaying the form name. I've assigned a button "Go to Related Record" with Get related record from the Forms table, but then I want to show the record using layout name by calculation. This is where I'm having problems. I don't understand what parameters filemaker is really wanting from me in the calculation. If I'm able to somehow grab the contents of the names in the form assignment table then I think this will be possible, but like I was saying I hardly know how to script anything in Filemaker. I'm very new to Filemaker and would really appreciate any suggestions!
bcooney Posted November 19, 2009 Posted November 19, 2009 I would add FormID to the Forms table, and not use the form name in any relationship. Layout by Calculation is attractive, but it requires a strict layout naming convention. So, form_1 would be the layout name for, um, Form1. You could Go to Layout by Calc ( "form_" & FormID). See how that'll break if you change the layout name? I prefer a nav script that allows me to rename my layouts and not break anything. User clicks portal row: nav to Form (scriptparameter set to the FormID) GTRR from portalTO::FormID to Forms by FormID If ( get (scriptparameter) = 1) Go to Layout (Form1) ElseIf (get (scriptparameter) = 2) Go to Layout ( Form2) ElseIf (an elseif per form layout) End If hth, Barbara
bstrad Posted November 20, 2009 Author Posted November 20, 2009 Thanks for the reply. The concept I'm having problems understanding is how am I supposed to appropriately assign the scriptparameter to the formID? I'm guessing I would need to do this by a calculation associated with the get(PortalRowNumber) fx. But my problem here is that in the Forms Assignment table I have multiple classes assigned to an individual form. For example inside my Forms Assignment table I have three records. The three records assign form1 and form2 to class1 and form1 to class2. If I am using the get(PortalRowNumber) to reference the record number of the related record in the Forms Assign table then I would be receiving one when I needed three since the assignment for form1 to class2 is in the third record. So in summary I'm still falling short on how to appropriately reference directly to the correct related record that is displayed in the portal. Thanks, Brandon
bstrad Posted November 20, 2009 Author Posted November 20, 2009 So I created a simple solution with your help and researching the topic a bit more. Set Variable [$layoutID: GetNthRecord ( Form Assignment: LayoutID; get ( PortalRowNumber ) )] Go to Related Record[From Table: "Forms"; Using layout:$layoutID] Thank you so much for your help, it really helped me understand the concepts better! Brandon
bcooney Posted November 21, 2009 Posted November 21, 2009 I'm sorry, I missed some days on here and didn't see your reply. To set the parameter, you would specify it in the Button Setup dialog. When you make a button, and set it to Perform Script, you will get a Specify Script dialog. In that dialog, you'll see at the bottom the ability to define a script parameter (and access to the calculation engine). I was suggesting that you simply pass the FormID to the script, and then navigate to the layout you need based on the FormID.
Recommended Posts
This topic is 5539 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