Jump to content

FMS 14 Exporting Found Sets through Scheduled Script


MikeM
 Share

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

Recommended Posts

  • Newbies

Hello,

Our school district has recently started to use Filemaker to automate some student data functions not available in our student information system.

I have run into an interesting problem when exporting tables based on found sets. When running the script using the server Schedule Scripts function, the export table seems to be ignoring the found set I have created in a layout.  I have tested the same script functions in the same order in the client and I get an exported CSV that is based on the found set.

Is there something I am missing in regards to context? I have read some of the documentation on the Filemaker site. It seems to state that there is no current context when the script runs, but I am loading a layout which I have then applied a Perform Find and then export using the same table as the layout.

Any insight would be helpful.

Mike

Link to comment
Share on other sites

The Server is not the same user as you. Imagine a completely newly opened file every time the script runs - that's what the Server uses.

The script must perform it's own finds and sorts and whatever else to get the correct set to be used - you can't do it on your machine and expect it to use that....

Hope this helps

Link to comment
Share on other sites

  • Newbies

Hi,

From my reading I think I understand the interactions and the server user vs the client UI.

Here is how my script(s) are setup.

Go to Layout [ "Active SD95 Staff" (tbl_StaffInfo) ] (onLayoutEnter if performs a find on a employee status field)

Set Variable [ $lbfilename ; Value: "/LunchBox/LB-SD95Staff.csv" ]

Set Variable [ $lbfileloc ; Value: "Get ( DocumentsPath ) & $lbfilename ]

Export Records [ No dialog ; "$lbfileloc" ; Unicode (UTF-8) ] (this exports 8 fields from tbl_StaffInfo, no related fields)

It appears to me that the Export Records function does not use the current layout context and just exports the raw table. I should have 179 records, but the file on the server has 386 records.

Using the same script steps in the client, I get a file with 179 records.

Is my code or thinking wrong? Other scripts that generate passwords, change status field, or import records all work as expected.  I am experiencing this with all my scripts using the Export Records on the server. This is our first attempt to use Filemaker with automated exporting, so maybe I am missing something.

MikeM.

Link to comment
Share on other sites

I tend not to use script triggers that are based on layout enter unless absolutely necessary because they can fire when you are not expecting it.

How about:

Set Variable [ $folder ; Get ( DocumentsPath ) ]

Set Variable [ $filename; "YourFilename.csv" ]

Go To Layout [ whatever ]

Enter Find Mode [ ]

Set Field [ YourField ; "Active" ]

Perform Find [ ]

Export Records

You can run this on the client or the server and both should return the same results.

Link to comment
Share on other sites

  • Newbies

That worked a lot better. At some point I tried just the Perform Find alone and without success.  I appears putting the layout into Find Mode makes the export work.

Thank you for showing me a different approach.

MikeM.

Link to comment
Share on other sites

This topic is 1794 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
 Share

  • 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 dataclip
      We have a couple of servers running on AWS. As of the middle of last week we suddenly are having connection problems. The server logs mostly lists error 10, sometimes error 51. These customers have poor internet connection, so we have set up a server and a client in the cloud. The users connects to the client through an RDP session. It is a Windows enviroment with one customer using Windows server 12 and FMS 14, the other Windows server 16 and FMS15. We use a seperate AD server to control the RDP access and accounts to the FMP server, clients have no acces to the FMS server.
      I have read previous posts on this issue. I do not think there can be any hardware issue, since the server is hosted with Amazon and both server and client are on an internal network. To be sure I have filed a support request with Amazon as well.
      The strange thing is that the error message sometimes occurs within a minute and then FMP freezes on the user while they are still working in the FM app. It is my understanding that error 10 occurs if the client does not respond to the server ping for 2 pings, so time out for this error should be 125 seconds. 
       

       
      These servers have been running without this issue for a long time now. Any idea why this has suddenly changed and why the error message errors while tghe users is using the FM app?
       
    • By Richard Fincher
      My production Filemaker Server 14 running on Mac OS X 10.11 El Capitan (Not Mac OS X Server) has been running fine for a year since I last installed the Thawte SSL Certificate.  After renewing the certifate this year, I've tried various different methods of importing the new certificate, which came with an intermediate certificate, but I can't seem to get the intermediate certificate installed.  I've been mostly using something like:
      sudo fmsadmin certificate import --keyfile /Users/richardfincher/Desktop/GBROOMX36-4X/private.key /Users/richardfincher//Desktop/GBROOMX36-4X/ssl_certificate.crt
       
      I've also tried importing it through the web control panel.  It was necessary to remove the old private key thus.:
      sudo rm /Library/FileMaker\ Server/CStore/serverKey.pem
      After it is (apparently) installed, I usually restart with :
      sudo fmsadmin restart adminserver
      although a few times I have rebooted the server (not a VM)
       
      Any thoughts welcome....
       
      Oh, one thing is, a year ago it might have been still on Mac OS X 10.8.5 Mountain Lion, which was the previous OS before I upgraded it.
    • By Elena2
      hello. I am extremely new to FMS. Is there a document anywhere that has best practices on server setup and Backup strategy in particular? Weekly full? daily? hourly; incremental backups? are there transactional backups? What are the issues, corruption issues? mistakes to avoid?
      We need this urgently. Believe that the server was not initially set up properly and now, of course, I have inherited the issue  We are running FMS 14
      any help would be appreciated,
    • By Ocean
      Hello FMForums,
      First off, hoping that I posted this in the right section.
      I have a script that is scheduled to hourly pull the URL source from a currency conversion site and store it locally for use. If I run the script from my computer on the database it will work fine, however if I run the script from the server it will give me a "scripting error 1631". I found that if you're inserting a "url" from a file then you must use file:/// before it or something like that to fix the issue, however I am inserting from an actual URL and am not sure if I've done something wrong.
      Script image is attached. If there is a better way to share my script then please let me know!
       
      Insert from URL is at line 5 & line 14. If the page source is already in the "source" field and I only run the part that finds the conversion rate in it, it works fine.

×
×
  • Create New...

Important Information

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