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

Add new record to linked table

Featured Replies

Hi folks,

I have 2 tables. Table A contains essential info about patients, and Table B contains dated consultation notes. The tables are linked via the "Client ID" field.

I have created a button on a layout for table A showing individual records which, when clicked, opens a table list view of the related consult notes for that client, from table B.

When in this table list view, showing an individual client's list of consult notes, if I select "new record" from the menu, a new blank row appears ready for more consult notes, however is NOT automatically associated with the current client ID.

How can I set this up so that when new consult notes are added to a current list (related to a given client ID), they are automatically assigned the currently 'active' client ID?

(e.g. via scripts/button or other) I'm not 'script proficient' so you'll have to spell that one out.

Thanks

DrChris

Why not create a portal to the notes records, in the client layout?

But at any rate, your script would be:

Set variable[ $clientID; Notes::ClientID]

New record

Set field [ Notes::ClientID; $clientID]

  • Author

Thanks Bruce,

Will give it a go.

I did try the portal option, however, my visit notes table contains a field container for images which I need to be able to see readily, and as far as I can tell, the portal is more limited in how I large I can display those images.

Keep in mind that this is ultimately running on an ipad via filemaker go, so screen realestate is somewhat limited.

Chris

  • Author

Back again,

Tried the suggested script but quickly realised I am not clear on some of the syntax. Below are the actual table names I'm using, and wondered if you'd mind filling in the blanks with the correct bits.

Main table = Animal Chiro v3

Consult notes table = Visit Notes v3

Common filed = Client ID

Thanks

Chris

Well, you could set the ClientID field to auto-enter a calculated value =

GetNthRecord ( Notes::ClientID ; 1 )

However, this could bomb if the found set is changed. The thing is, when you are in the Notes table, there is no "currently active client".

  • Author

Well, you could set the ClientID field to auto-enter a calculated value =

GetNthRecord ( Notes::ClientID ; 1 )

However, this could bomb if the found set is changed. The thing is, when you are in the Notes table, there is no "currently active client".

I figured that by putting a button on the Client's main page, that linked me to their related records from the consult notes table, I was basically looking at the results of a search based on the Client ID.

However, I have wrongly assumed that if I then added a new record, whilst the found related records were still showing, it would be added for the same Client ID.

Also, the button doesn't work (i.e. link to related records) if there are no existing consult notes for that Client ID, nor does it automatically generate a new one for that client.

Looks like I need to do some more learning before I go further.

Chris

the button doesn't work (i.e. link to related records) if there are no existing consult notes for that Client ID, nor does it automatically generate a new one for that client.

You could do something like this (roughly):)

If [ Notes::ClientID ]

Go to Related Record [ Notes ]

Else

Show Custom Dialog [ "There are no notes. Create a new note?" ]

If [ Get (LastMessageChoice) = 1 ]

Set Variable [ $clientID ; Clients::ClientID ]

Go to Layout [ Notes ]

New Record

Set Field [ Notes::ClientID ; $clientID ]

End If

End If

I have wrongly assumed that if I then added a new record, whilst the found related records were still showing, it would be added for the same Client ID.

There is no memory of how you arrived at a layout, nor of how you created the found set. That's why auto-entering the ClientID is a rather iffy proposition: it assumes you wouldn't create new records in the Notes table under other circumstances.

Thanks Bruce,

Will give it a go.

I did try the portal option, however, my visit notes table contains a field container for images which I need to be able to see readily, and as far as I can tell, the portal is more limited in how I large I can display those images.

Keep in mind that this is ultimately running on an ipad via filemaker go, so screen realestate is somewhat limited.

Chris

You can make the portal row height whatever you want, just as you can with the notes list view. You can also create a "selected note" feature and show only the image for that note if you want.

  • Author

You could do something like this (roughly):

If [ Notes::ClientID ]

Go to Related Record [ Notes ]

Else

Show Custom Dialog [ "There are no notes. Create a new note?" ]

If [ Get (LastMessageChoice) = 1 ]

Set Variable [ $clientID ; Clients::ClientID ]

Go to Layout [ Notes ]

New Record

Set Field [ Notes::ClientID ; $clientID ]

End If

End If

That looks like a good option.

Definitely have to learn a lot more about scripting!

  • Author

Just to check though,

where I see the expression "$clientID" as people type it in these posts, do I have to enter anything here (other than the correct field name)?

i.e. is the $ sign a variable I have to manually enter when designing the script, or just leave it as is?

[color:blue]$clientID is the name of the variable you are creating - you can use any other name, if you like.

[color:blue]Clients::ClientID is a (fully qualified) name of a field - you need to use the actual name of your field here.

  • Author

So with the expression "$clientID", I have to preface the 'variable name' with the '$' sign. Yes?

Yes, either that or $$ (for a global variable). See the help on the Set Variable[] script step for more.

  • Author

Thankyou!

There doesn't seem to be an shallow end to dive into when it comes to some of this stuff. Just have to keep swimming!

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.