September 25, 201312 yr 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...
September 25, 201312 yr It seems to me you're thinking that giving a variable a certain name (e.g. the same name as a field) will give it some associated value. That is not the case – you can name a variable anything you want, but you need to explicitly assign a value to it, and then (in your script) use the variable as the result in the Set Field step for the ID (that's the reason why you've created it …). Change your script like so (using your specific object names, of course…) Set Variable [ $patientID ; Patients::patientID_pk ] # 1st value in “Name”, 2nd value in “Value” Go to Layout [ Journals … ] New Record/Request [ … ] Set Field [ Journals::patientID_fk ; $patientID ] # Specify Field Name, Specify Calculated Result Commit Record Go to Layout [ original layout ] # etc
October 4, 201312 yr Author Thank you for replying eos. It so helpful for me as a beginner to have this forum to turn to. Thank you once again!
Create an account or sign in to comment