Wayne Irvine

Change field in portal row

8 posts in this topic

I have a FileMaker layout with a portal to another table. The relationship shows all unassigned records (related < 1). On each portal row I have a button which runs a script. The idea is that when you press the button the a value from the main record is copied and pasted into a field in the portal row (and as a result the portal record becomes 'assigned' and is removed from the portal.

I have the button running a script and pasting the value from the main record but it is pasting it in the first portal record, not the one whose button was clicked.

Is there a simple way of having the value pasted into the portal record where the button was clicked or do I have to store the record number (or something) and paste back to that record?

Screen Shot 2017-01-10 at 6.29.19 pm.png

Share this post


Link to post
Share on other sites

Why don't you post your script, so we can see? Offhand, I would say that a simple:

Set Field [ Related::SomeField ; Main::SomeValue ]

should suffice; as long as the button is in the portal, this will operate on the related record shown in the portal row where you clicked.

Share this post


Link to post
Share on other sites

I was doing a bunch of copy and pasting etc but Set Field works first go. Thanks.

Share this post


Link to post
Share on other sites

On a further issue, how do I get the page to refresh? One portal is showing available records and the other, liked records. When I Set Field to the value of the main record it is no longer Available but is now related. If I remove the focus (click somewhere else) it updates. There must be a fucntion for this. I have tried 'Refresh Window'.

Share this post


Link to post
Share on other sites

 A button can either be set up to make an immediate, single-step action.

Or it can be set up to call a script, which takes that action plus does some other things.

Set the button to call a script, which uses the set field action you're already performing, followed by:

Commit Record

Refresh Window [ flush cached join results]

Note that it may also help to put a Freeze Window statement as the first line of the script.

Share this post


Link to post
Share on other sites

Brilliant! Thanks for that.

It's been decades since I played with scripting in Filemaker and a lot has changed.

Share this post


Link to post
Share on other sites
10 hours ago, Wayne Irvine said:

I was doing a bunch of copy and pasting

Copy and paste is in the province of the users. You (the developer) shouldn't use it, unless the script is meant to assist the user in data entry.

 

10 hours ago, Wayne Irvine said:

If I remove the focus (click somewhere else) it updates.

Clicking on the background commits the record, and that's what your script needs to do too - sorry for not making that clear. I don't think you need to do anything beyond that, unless you run into refresh issues.

Share this post


Link to post
Share on other sites
17 minutes ago, comment said:

Copy and paste is in the province of the users. You (the developer) shouldn't use it, unless the script is meant to assist the user in data entry.

Hi Wayne, to explain a bit more ... not only does copy destroy a User's clipboard contents (usually needlessly, as Comment explains) but paste requires that the field being set exists on the current layout.  Down the road, you may remove that field and cause your script to fail, forgetting that it is dependent upon that field.  No such issues exist using Set Field[].

And welcome to FMForums!  :-)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • By Wayne Irvine
      I want to start at 1 for the next quarter, but it is currently 13 days before the end of this quarter. Logically I could start auto-enter serial at -13 and incrememtn by 1. So the first record would be -13, then -12 etc.
      Doesn't seem to like it. First record is -13, second is -14.
      Is this a bug, a feature, or known behaviour?
    • By Wayne Irvine
      I have a portal that shows records from another table. They are 'available' or not currently assigned records.
      The problem is that the list is too long. I would like to be able to filter the list by entering characters in a Filter field.
      The relationship currently looks like this:
      Available = yes
      I would like something like:
      Available = yes 
      and
      Filter (is a substring of) Productname
      I can't for the life of me figure out how to do that.
       
    • By Wayne Irvine
      I have a look up table of products with parameters such as style, size, colour etc and of course price.
      In another table I have the items ordered which allows you to choose a style, size, and colour and looks up the price form the products table.
      I achieve this calculation using a field which contains a concatenated string like this 'style-size-colour' in both tables and a relationship based on this field. I use this relationship to return the price.
      It works the first time, but when I change one of the parameters the price is not immediately updated.
      How do I force a refresh?
    • By OPS
      I have a table called Employees. These are either Current, Freelance, or No Longer Employed.
      I want a list available to select current employees. I have a filed called Currentcalc which is a 1 if the employee status is current. All I want to do is to go to an unrelated table and be able to select current employees from a lost. I simply cannot get my head around how to filter lists. I have tried every possible combination of settings and cannot understand the logic of filtered lists.
      This should be so simple but I have now wasted an entire day to it. I cannot find a simple explanation on how this works, anywhere. Can anyone explain to me how drop down lists, based upon a calculation filed work?
    • By Greg Hains
      Good morning.
      My client has FMS14 running on a terminal server with about 8 clients using it at any one time from that terminal server. From the reports I am getting back, when they open the solution, they are getting a message that appears to show that the Network Sharing has been enabled. As I understand it, when the solution is hosted on FMS, then the Network Sharing (for peer to peer?) should be disabled, however, even after turning off Network Sharing, it appears to come back again. Why is this? How do I stop it please?
      The only problem it seems to be causing is the initial error message when the solution is opened. I access the file remotely (not through the TS) and I don't get that message - I'm also the only Mac client if that makes any difference.
      Any ideas would be appreciated. :-)
      Greg