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

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

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 ShelCOYS
      Hi, I have fm 14 server running on a mac mini. I have recently upgraded to FM16 running Mojave on 2 x local macs. We started with one license, where only one of us could use FM at a time (as we knew), I have since bought another copy and and reinstalled FM16 on the local mac with the new serial number but the server still seems to think we are using the same copy?? and we are getting the attached error. I have completely uninstalled FM locally but still does not work. I have asked my FM guy, as well as 2 or 3 other people but everyone seems to be stumped?? Is there any way of clearer the cache which may be holding this old information? Any help would be much appreciated.

    • By Gaohan
      Dear all,
      I'm new here so forgive me if not posted in the correct location. We have the following situation for which we do not know how to continue:
      We have Filemaker server running on a windows server. The server is accessed through its local ip address (in the 10.10.10.x block). For an internal application I would like to extract information from a FileMaker database for usage in another application. Initially, I used the xmlresultset grammar. It works for when requesting the databases hosted on the server (i.e. : http//10.10.10.x/fmi/xml/fmresultset.xml?-dbnames returns the expected result). However, when I attempt to retrieve a list of layouts that are available I keep getting an empty body result:
      http://10.10.10.x/fmi/xml/fmresultset.xml?-db=Test&-layoutnames Returns the following contents (Note the content-length = 0):
      [Chrome section: General] Request URL: http://10.10.10.x/fmi/xml/fmresultset.xml?-db=Test&-layoutnames Request Method: GET Status Code: 200 OK Remote Address: 10.10.10.x:80 Referrer Policy: no-referrer-when-downgrade [Chrome section: Response header] Content-Length: 0 Content-Type: text/xml;charset=UTF-8 Date: Mon, 19 Nov 2018 16:01:06 GMT Server: Microsoft-IIS/10.0 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Powered-By: ARR/3.0 X-XSS-Protection: 1; mode=block [Chrome section: Request headers] Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.9,nl;q=0.8 Authorization: Basic XXXXXXXXXXXXX Cache-Control: max-age=0 Connection: keep-alive Cookie: JSESSIONID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.jwpc1 DNT: 1 Host: 10.10.10.x Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 I specifically made a layout that should return content as a table view of the records.
      I have verified with PHP, and it shows the same problem.
      I have read on some forum that layouts should be made available through web-publishing as well. How to do this? I cannot find it in the documentation.
      What else am I missing?
      Hoping for an answer!
    • By cat traveller
      Hi everyone,
      on a file accessed via filemaker Go 17, I am using a scripted navigation to move records up and down in a portal that is inside a popover.
      This has worked in filemaker 12 like a charm and also works on a filemaker client. The records smoothly move up and down the list. 
      However in Filemaker Go, the portal follows every move of the script as if it is not aware of the freeze portal.
      EG the down button is to move the record one record further down inside the filtered and sorted portal (like so)
      This is the script.

      - freeze window and go to portal
      - go to first line of portal and loop through the portal until I hit the record to move
      - go to next line and give the position field the value of my record to be moved
      - go to line above and give the position field the value of my record +1
      - commit record and refresh portal via an x join 
      - go to last line of the portal 
      - go to the line of position of my record to be moved. 
       
      Would anyone be aware of this issue or know a workaround to stop the portal from flickering?
       
      Thanks so much
       
    • By Gismo12
      Hi,
       
      I have a drop down in a portal, how do i filter the drop down box to only display the record relating the record in focus on the active layout where the portal is inserted?
      example: I have a customer selected in my customer layout, the customer has several products related to that customer. when I click on the drop down list in the portal, I only want to see the products for that specific customer. The drop down is in the warranty portal, products are saved in the product table with a reference to the customer.
       
      Please could you assist?
    • By H
      Hi
      i have 3 Tables Property , Units , Tenant.
      Each property has many units , Each unit has one tenant active but may have many inactive tenants from previous years.
      All working fine BUT.....
      i would need to show a table in the property layout of the units and each one only with its active tenant.
      The portal is based on the units table. 
      However the tenant just show up the tenant that was first input to the unit.
      My question is , how could i get that only the active tenant should show to the unit?
      i would really appreciate it someone could guide me on this.
×

Important Information

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