Is there a commit records step in the script? (There should not be.)
What you describe is typical of a script where the focus on the clicked portal row is lost before it can be used to find the matching records.
Thanks for taking an interest in my problem.
What I don’t possess at the moment are the skills to “script” this behaviour so that if an end user simply clicks (not right clicks) on, a portal row, it will then do the same as if the end user right clicked on the portal row and selected "Find Matching Records" in the quick menu.
Is there an easy script I should be using, and if so, how can I do this – using Button Setup? Assigning a script? I have not assigned a script yet in my (brief) acquaintence with FileMaker Pro. Is there a "script trigger" that I also need to be aware of?
Thanks for any help
Scott, when you right click in a portal row, to get the "Find Matching Records", it's because you right clicked a field. If you just right click a blank spot in the row you only get "Copy".
If it's a 1 row, 1 field portal, its easy to make a button. If it's multiple field portal, the field you make as your button (or script trigger) is the field you want to get the related records from right? In other words, say there's a portal row with date, amount, total. If you right click date, and select "find matching records...you get all records in that same table as the portal (not just that customer) that are from the same date. If you right click amount, you get all matching records from the table that match that amount (once again from all customers).
So to best answer your question, do you want the user to click a field in the portal and find all matching records of all the customers from that table (as defined by the portal)? Or do you want clicking a button on a portal row to bring you to that related record only, or all records related to that customer?
So provide the answer to one of the 3 questions above, and someone can easily help you with the proper script.
I think Steve has put his finger on the problem. Your button needs to be inside the portal row so that the mouseclick on the button both selects a specific portal row and performs the assigned Find Matching Records script step.
As a test, I formatted a field in a portal as a button to perfrom that step and it worked correctly.
And keep in mind that this finds matching records in the Layout's table, not the portal's. If you do a find matching on a portal field that has "Apple" in the field, you are finding all records in the layout table that are linked to at least one record in the portal's table that has "Apple" in that field.
Thanks for your interest in my problem. To use your examples I want the user to click a field (keywords) in the portal and find all matching records of all the customers (casenotes) from that table (as defined by the portal).
At the moment, I have no scripting knowledge, and am using the building blocks supplied by the Button Setup menu. I am converting the field (which is inside the portal) to a button, using the Button Setup. I attach a screenshot to show what I am doing. Upon doing all of this, the problem I am experiencing is that if the end user clicks on any of the "keywords" in the portal, the record set is returning only those casenotes that have the keyword in the first portal row, not the keyword in the portal row / button that was clicked.
Looks like you are specifying the wrong field. Specify keyword_display name instead of keyword_id and see what happens.
And something is odd here as this field should appear in your specify fields dialog and does not. Is it from some other table than casenote_keyword?
What table is it from and how is it related to casenote_Keyword?
Thanks for your help. I have specified a different (hopefully correct) field. But I am still having the same issue. Could I interest you in downloading a trimmed down version of my file which shows the problem. It is an 800 kb file from my dropbox.
When you open it up, it will be on the first casenote record (see attached screenshot). I find that if I convert the portal field to a button (which I have), if you click on the second portal row "representative government", it will return the set of records that have the first portal row ( "electoral law (all)" ) as a keyword. If I turn off the button, and instead right click on "representative government" and select "Find Matching Records" from the menu, I get the behaviour that I want, that is to return the set of records that have "representative government" as a keyword.
I just cant replicate this behaviour in a button. Again, thanks for your interest.
On the other hand, you could have just answered the question:
What table is it (keyword_displayname) from and how is it related to casenote_Keyword?
As I had noted earlier, this field does not come from the same table as that of the portal's.
Opening the file and looking shows that you have a many to many relationship with a portal to the join table and this field comes from a different table also linked to the join table. Then you have changed the portal to be from this other table instead of the Join table as shown in your screen shot.
I think you've found a bug in the software that should be reported in Report an Issue. What's weird is that even using a join table based portal and setting up an id field from the join table fails. It may be that my test works as I was using a file and layout converted from FileMaker 11 to FileMaker 12.
I did come up with a work around by setting up the field/button to perform this script:
Set Variable [$ID ; value: casenote_keyword::keyword_id ]
Enter Find mode 
Set Field [ casenote_keyword::keyword_id ; $ID ]
Perform Find 
Thanks for all your help. Script works great.