Jump to content
Server Maintenance This Week. ×

Change field in portal row


This topic is 2662 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
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.

Link to comment
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'.

Link to comment
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.

Link to comment
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.

Link to comment
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!  :-)

Link to comment
Share on other sites

This topic is 2662 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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