Jump to content

Can't get the BE_ListFilesInFolder to work with Server Scheduled Script


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

Recommended Posts

"This is the first time I'm setting up a script to run on a server with the help of a schedule, so I will probably make a lot of strange mistakes, but how hard can it be? 
Hard, obviously. :|"

I have a script that check for new files in a folder, process them, export some data and move the files to a new destination. It works flawless with the Filemaker Client. 
On the Server I can't get it to work! I'm using the BE_ListFilesInFolder step.

The folder that I want to check is the following (the FMServer User have both read and write privileges on all mentioned folders): 

C:\FTP\FM\In\

This is outside the server Documents folder, so just to be sure I tried to change it to: 

C:\Program Files\FileMaker\FileMaker Server\Data\Documents\In\

I get the same error on both. 

 

I have tried to use a field as the path as well as hardcoded as well as variables in different combinations: 

BE_ListFilesInFolder ( System::FMIn Folder ) 

BE_ListFilesInFolder ( "C:\Program Files\FileMaker\FileMaker Server\Data\Documents\In" ) 

Set variable($folderpath) and then BE_ListFilesInFolder($folderpath)

Same error. 

 

I have tried a zillion different ways. With the Client it works. From the server it does not. I GET CRAZY!!!

What have I missed? :(

...or should I just skip the Filemaker Server Schedule and do this with a client instead?

Tia, 
/Andreas

[Windows 2012 r2, FM Server v15.0.1.137] 
 

Link to comment
Share on other sites

I'm using 

Let(_path = Substitute(Get(DocumentsPath);"/";"\\") & "Manifest_Detail_Imports\\";
Right(_path;Length(_path)-1)
)

then BE_ListFilesInFolder ( $_import_directory;"csv" ) to list the contents of the directory

to read the contents of \Documents\Manifest_Detail_Imports on my server 

Screen Shot 2016-10-05 at 17.00.23.png

 

doing it server-side is massively faster and less troublesome than using a client to run imports.

Edited by _ian
  • Like 1
Link to comment
Share on other sites

3 hours ago, carlsson said:

 

I have tried to use a field as the path as well as hardcoded as well as variables in different combinations: 

BE_ListFilesInFolder ( System::FMIn Folder ) 

BE_ListFilesInFolder ( "C:\Program Files\FileMaker\FileMaker Server\Data\Documents\In" ) 

Set variable($folderpath) and then BE_ListFilesInFolder($folderpath)

Same error. 

 

 

What is the error you are getting?

Link to comment
Share on other sites

Thanks for the example Ian, I will look into this soon.

I agree about doing it on the server side, it feels better as well. That's why I'm struggling with it... 😝

Wim; I got some different errors. 3 and 113 if I remember correctly. Now I only get a "?" as a result from the BE command. However, doing it from the client side (on the same server) gives no such error. And the plugin IS installed.

Link to comment
Share on other sites

3 = an unsupported script step. That should be easy to identify by looking at your involved scripts with the 'server compatibility' view turned on.  Remember that server-side scripts also run the OnOpen script first, and look out for any triggers on layouts and records that you may have going on.

113 = function is missing, probably goes hand in hand with the below

? = the plugin is either not installed or not enabled.  This too is easy enough to troubleshoot by using the Get(InstalledPlugins) function at the beginning of your script and log the results.

In general: since you can't use script debugger for server-side scripts while they execute you need to beef up your error trapping and overall progress.  Log every step of the way so that you can narrow down where you have an issue.

  • Like 1
Link to comment
Share on other sites

This topic is 2757 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.