Jump to content
Wayne Irvine

Change field in portal row

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

Share this post


Link to post
Share on other sites
comment    1,369

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
BruceR    152

 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
comment    1,369
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
LaRetta    477
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 docasar
      Hi,
      I have just downloaded the 360works Email plugin Sample and I am doing some tests to check whether this would solve my problem. I would like to be able to download all emails from my email account into "messages" table and then on each customer record show those emails which are related to that customer via a portal based on a relationship between, but what I can not figure out how to do it is that the portal would show but types of emails those marked as "from" emails and those marketd as "to" emails. So far I have created a relationship between Customers::email  ------- Messages::From and the portal would show all "from" messages. If I would set the relationship as Customers:email ------ Messages:To, the portal shows all "to" messages, but what I am trying to make is a join portal that would show by date both "from" and "to" messages, then I plan to make a Conditional Formating saying that if Customers:email = Messages::From then all text in blue, and all text in green when it is TO.
      Is this something that can be achieved?
      Thanks a lot for any tip,
      Luis
       
    • By TJ53
      I guess people are using a similar technique for creating and editing portal records after the new FM16 card window feature, any posts or links about this?
      In any case, this is how I'm doing it (sample attached) ... any feedback appreciated!
      Create or edit portal records.fmp12
    • By wedgeman
      So i'm dealing with two tables.
       
      1.  VisitTable.
      2. GraphicsTable
       
      in a VisitTable layout, i have one or two portals related to the GraphicsTable, each related by a different factor.  One portal would be related by a Date field, the other would be a ClientName field..
      My desire is to click on a thumbnail in either one of these portals, and have that selected image be displayed in a separate/larger image window (which could be a container field in the current table, Or another portal?  I don't care how - i just need to have it show up) 
      I don't know the best method for doing this (ie., click thumbnail to have image fillin a separate location).  In this particular instance, I don't want this to be a separate window, but to display in a container field view on the current window/layout. 
       
      how do I accomplish this?
      thx
       
       

    • By wedgeman
      Table 1 (Visits) is a clinic visit table, with numerous fields of data.
      Table 2 (Prescriptions) is a related table for prescriptions given on a particular visit. Table2 is related to Table1 by fkey  - - -    T1ID.
      Table 3 (Patient) is a patient table (contacts).  PatientID is the identifier for Patient and is related in Visits,Prescriptions, and Patient
      I need to have (in a Visits layout) a portal (self-related by PatientID), which shows a list of previous visits to the clinic by this patient.
      On this portal I need to show any (1 or many) Prescriptions (from Prescriptions table) which would've been given during that particular Visit
      So it's in essence a need to show 2 foreign tables (1 being a self-view by PatientID and the other being the Prescriptions but filtered by PatientID
      I have been unable to figure out a good method for this.
      My only thought has been to give up on working *IN* Visits, but creating a separate table ("Combiner"), and in Combiner, hold all Visits and Prescription data.
      Could I also have a Combiner table that's simply an active "calculation" table, where these two tables are 'looked up' on an as-needed basis, combined, and fed into Visits via a portal? (so it's not actually held data, but is looked up as needed)
      what's the preferred method?
    • By shencearn
      macOS Sierra Version 10.12.5
      trying to install FileMaker Server 14 with Web Server & PHP. I need web publishing enabled. I checked PHP and Yes, install the FileMaker server version of PHP.
      I get this error. Test web server (http://127.0.0.1:80/fmi-test/test.xml): Connection refused
      I have no idea where to start troubleshooting. I read through https://fmhelp.filemaker.com/docs/14/en/fms14_getting_started.pdf and nothing helped.
      Please help. Its appreciated.
×

Important Information

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