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