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 Hijack
      I have a couple of sequence scripts configured on our FM14 server (under Windows 2008 R2) and for some reason, the system level scripts after the internal FM scripts no longer launch under the identity I specify in the schedule config.  They always launch under System and that's causing access problems.  The server has been rebooted and I have tried brand new schedules for the tasks but nothing changes.  Anyone seen similar behavior and have a solution?
      Thanks
    • By ernst
      I had to migrate a Mac OS Mini Server running Mavericks 10.9.5 and Filemaker Server 13 to Filemaker Server 14.0.4 on El Capitan 10.11.6 today.
      It turned out to be an unpleasant and tiring operation, so I wrote a little manual that hopefully can help and save time for other people running into this situation.
      Some steps my not be necessary, but the following list describes the road I took, stumbling from one problem to the next.
      Rest assured that I left out a lot of swearing and three letter words that were also part of the process ;-)
      Greetings Ernst
       
      Backup your databases, stop and de-install any previous Filemaker Server version. 
      The Filemaker 13 de-installer is located in the Extra’s folder on the Filemaker Server 14 installation disk image.
       
      Install El Capitan 10.11.6 + updates 
       
      Do not install OS X server ( yet ) - see the notes at the end of this little manual.
       
      Remove the Java version installed with Mac OS - in my case Java 8 update 111.
      Steps from the Oracle website:
      In the Terminal window Copy and Paste the commands below:
      sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin 
      sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane 
      sudo rm -fr ~/Library/Application\ Support/Java
       
      Install the version required by the 14.0.4 Filemaker Installer: Java 8 update 60 before installing Filemaker.
      Installer is called: jre-8u60-macosx-x64.dmg
       
      After creating an Oracle account and logging in it can be downloaded from:
      http://www.oracle.com/technetwork/java/javase/downloads/
      - Scroll all the way down and click Java Archives
      - Click Java SE 8
      - Scroll down to Java SE Runtime Environment 8u60
      - Click Accept License Agreement
      - Download jre-8u60-macosx-x64.dmg
       
      The Filemaker installer is supposed to install this Java version by itself, but in my case it appeared to contain the Java 8 update 31, causing a loop within the Filemaker installer, repeating the process of installing the wrong version.
       
      Get Filemaker fms_14.0.4.412.dmg. 
      Use the full installer!
      In my case installing an earlier version and running the updater did not work - the updater to 14.0.4 hung during installation.
      Filemaker also advises this but unfortunately chose not to put the full installer on their website, so I had to Phone Filemaker support and supply the original sales contract number. After providing these details they mailed a link to the 14.0.4 full installer.
       
      Install fms_14.0.4.412.dmg 
      Because I was planning a co-install with OS X Server App I used port 8080 and 8443 in stead of the standard 80 and 443 during the setup.
      Also I did not enable web publishing and ODBC/JDBC during installation because I desperately wanted to get the normal services working.
      Do not start Deployment when the installer finished but click Quit in the finishing dialog.
       
      Next step is to stop the server process via the terminal, as per Filemaker’s instruction: type or paste sudo launchctl stop com.filemaker.fms in a terminal window, enter and administrator password when required.
      In my case I had to restart the Mac and do this last step again after a fresh restart, before the FileMaker Server 14.0.4b Software Patch wanted to run without complaining about the Server being running.
       
      Run the FileMaker Server 14.0.4b Software Patch from http://help.filemaker.com/app/answers/detail/a_id/15575
      Note that this installer will update your Java version to Java 8 update 66, in my case this went without any hiccups.
      Log in to the Admin console using the FMS 14 Admin Console.webloc shortcut placed on the Desktop by the installer.
      Alternatively point your browser to http://localhost:16001 and click Start Admin Console
       
      About co-installing with OS X Server version 5.2
      I know the true purist warn against this; in this case the server is under a relatively light load, so performance does not seem to be an issue.
      Getting OS X Server to co-exist with FM Server proofed tricky though. 
      Initially I had OS X Server app installed before trying the last FileMaker Server 14.0.4b Software Patch which caused the installer to hang again. 
      So I had to command-drag to move the Server App from the Applications folder to the Desktop. After authenticating the Mac detects the removal and presumably stops and repatches all services involved.
      Then the FileMaker Server 14.0.4b Software Patch installed, after which I could put the OS X Server app back, re-login to server, re-enable the services, restart the Mac and finally login to the Filemaker Admin console.
       
      Next time I would leave the OS X Server installation as last step; possibly this will be less work.
       
    • By Aussie John
      Hello all. I am running the FMS 14 backup scripts to a custom folder on the same disk as the Filemaker install. There are a number of errors generated.
      Schedule window Status says "permission denied"  Main Status window say "Schedule "Daily" aborted; the destination "filemac:/server HD/fmsbak/" is not writable." Folders ARE created the backup databases but some files are corrupted (although others not) The backup folders do not delete after the schedule number of backups. And only recently I can't change the folder path as nothing happens if I validate or save and to log out I have to revert.  
      Any help with this would be terrific. Thanks
    • By sinisa93
      Hi!
      I have two separate questions regarding portals and how they work. Before I start let me describe what I'm doing. I'm constructing DB for local karate club. I have one table/layout with general info about members, I have second table/layout with records about belts (including color of the belt, when & where the belt was obtained, the mentor of the member & sparing partners of the member etc.) and I have 3rd table/layout that shows various activities of each member (there are also several other tables but not important for this topic). All tables are connected via key field (ID number)
      QUESTION 1
      I have no problem creating portals on 3rd layout to show me which belts particular member has with all additional info from the second table that go along with it. BUT I don't know how to create a portal that shows all members of the club that had particular member as sparing partner. Thing is that I have 3 separate fields for sparing partner because each member can have up to 3 sparing partners and I simply don't know how to connect them all so I can see the list of all members that have particular member as one of three possible sparing partners.
      QUESTION 2
      I know how to place count of related records in filtered portal but I'm not sure how to get a Total of this counts.
      Any help is much appreciated!
       
    • By Volker Gurtler
      The database has table1 with “Sample No” field relating it to table2 with “Sample No” field. Table 2 has a portal on a layout with Table1. Each portal row has the Category field with one of 3 values (MF,BP and CC). There are about 7000 samples. Each sample has from 1-12 portal rows displayed with 1 or more occurrences of the 3 category values one of the values shows the count of each value per sample.
       
      The question is how do I write a script so that every sample has all 3 category values (MF,BP and CC)?
       
      I have the following scripts for when there is only one value/portal - one for each of the 3 values (3 scripts are the same except that “Molecular Function” is substituted for BP or CC and “Molecular Function” = MF):
       
      Perform Find [ Specified Find Requests: Find Records; Criteria: Transcript Database::Regulation: “=test” ] 
       
      [ Restore ] 
      Perform Script [ “Sort by Sample No” ] Go to Record/Request/Page 
      [ First ] 
      Loop
      Go to Portal Row 
      [ Select; First ]
      If [ GO_GOT::Putative Gene Function Category 
      "Molecular Function" ] 
      ≠ "Molecular Function" ] 
      ≠ If [ GO_GOT::Putative Gene Function Category 
      Go to Portal Row 
      [ Select; Next ] 
      Go to Portal Row 
      [ Select; Last ]
      Set Field [ GO_GOT::Putative Gene Function Category; "Molecular Function" ] 
      End If End If 
      Go to Record/Request/Page 
      [ Next; Exit after last ] 
      End Loop 
       
      I can not get a script to work on a portal with only 2 categories so that only one of the 3 categories is added per sample.
      Transcript Database v05 test.fmp12