Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Create record in related table

Featured Replies

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.