Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4129 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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...

post-109713-0-84485300-1380143680_thumb.

Posted

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

  • 2 weeks later...

This topic is 4129 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.