Create record in related table
I am new to Filemaker and have set up a simple database with two tables: "Patient" and "Journal"
They are created in a one to many relationsship with the field "PatientId" in the patient table and "PatientIdFk" in the journal table.
What I would like to create is a script so I can run that script via a button on a layout called "patient" and create a new journal record (and by the same time go to the layout I have called "journal")
Each patient can have more journals.
I know I can do that through a portal, but it is unfortunately not the best way for me, and I would like to do that via a click on a button outside the portal.
Hope it all make sense.
I have tried to create a script (See attachment) but I can´t seem to get it to work. It DOES create the new record and gives it a unique "JournalId" but it does not link it to the patient.
Any help is appriciated. Thanks...