How to get portals to update correctly

Discussion created by karljones37 on Apr 12, 2013
Latest reply on Apr 12, 2013 by timwhisenant



I have a layout displaying a 'Class' with a portal showing 'Students' in that class. 'Class' and 'Students' are joined using a 'StudentRegisters' table with just the Student Id and the Class Id.


To add a student to the class i have a script that, while the main window stays on the class record, displays a list of students to select.

When a student is selected a new record is added to the 'StudentRegisters' table.


This all works fine, records are added correctly, but they do not always display until i have navigated away from the 'Class' record and back again.


How do I refresh my portal in the 'Class' layout so that is shows the new records straight away?





I create by student list selection window thus:


The ClassId is passed as a parameter into the script



Freeze Window

New Widow [Name: "Attach Student"; ....etc

Go to Layout ["Attach Student" (Students)]

Set Variable [$$ClassId; Value:Get(ScriptParameter)]

Show/Hide Toolbars [Lock; Hide]


When the user selects a student the following script is run:


Set Variable [$$StudentId; Value:Students::Id]

Go to Layout["Student Registers" (Student Registers)]

New Record/Request

Set Field [Student Registers::ClassId; $$ClassId]

Set Field [Student Registers::StudentId: $$StudentId]

Commit Records/Requests []

Go to Layout ["Attach Student" (Students)]


I am new to Filemaker, looking at some of the examples this was the best I could do.

This produces the correct results but the portal on the Class layout isnot updating to show the new Student.

(Actually, sometimes is does. It sometimes shows the addition of the previous student - add Student A see nothing add Student B see Student A, add Student C see Student B etc..)

(Also, if the portal has had a record deleted, this seems to stop any added records being display)


I'd be very grateful for some help on this.