FysiOlsen Posted September 25, 2013 Posted September 25, 2013 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...
eos Posted September 25, 2013 Posted September 25, 2013 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
FysiOlsen Posted October 4, 2013 Author Posted October 4, 2013 Thank you for replying eos. It so helpful for me as a beginner to have this forum to turn to. Thank you once again!
Recommended Posts
This topic is 4321 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