August 9, 201015 yr 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
August 9, 201015 yr 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]
August 9, 201015 yr 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
August 9, 201015 yr 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
August 9, 201015 yr 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".
August 10, 201015 yr 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
August 10, 201015 yr 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.
August 10, 201015 yr 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.
August 12, 201015 yr 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!
August 12, 201015 yr 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?
August 12, 201015 yr [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.
August 12, 201015 yr Author So with the expression "$clientID", I have to preface the 'variable name' with the '$' sign. Yes?
August 12, 201015 yr Yes, either that or $$ (for a global variable). See the help on the Set Variable[] script step for more.
August 14, 201015 yr 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