Jump to content




Server Side Imports and Exports



  • This topic is locked This topic is locked
26 replies to this topic

#1 OFFLINE   Steven H. Blackwell  Humble Servant

Steven H. Blackwell
  • Moderators
  • 4,388 posts
  • FM Client:12 Advance
  • Platform:Cross Platform
  • Skill Level:Authorized Trainer
  • Certification:7, 8, 9, 10, 11
  • Membership:FileMaker Business Alliance, FIleMaker Platinum Member
  • Time Online: 3d 17h 15m 45s

Posted 28 January 2009 - 12:36 PM

This is a joint message from Wim Decorte and Steven H. Blackwell.

We have been seeing a number of reports that indicate there is considerable confusion about the new server side import and export capabilities of FileMaker® Server 10 and FileMaker® Server 10 Advanced.  We want to assist developers by clarifying how this new feature is supposed to work.

First and foremost, there are only 2 folders that FileMaker Server can use to export to or import from:
1. the Documents Folder in the root level of FileMaker Server.
2. A temporary folder created (and deleted) for the instance of the script schedule

This apparent limitation addresses permissions issues in the privileges bubble in which FileMaker Server runs.  The account that runs FileMaker Server has access to those folders but not necessarily others.

The import/export path cannot be dynamic when using the export or import feature on the server. The temp path gets generated for each script session so it will vary from schedule to schedule.  On Windows that path looks something like this:
C:/WINDOWS/Temp/S43
The name of the subfolder is specific for the running script schedule and is deleted when the schedule ends.

If you want to use a location that persists, your only option here is to put the file in the FileMaker Server Documents Folder and import from there or export to there.

Here is an example of an export. Given a file with a table alias City  with fields Country and City, and a layout named Test, the following construct will produce an exported file called testfile.txt when it is run server side.  The file will be sorted by Country, then by City, will contain all records for the table, and will be a tab delimited text file.  The script:
Go to Layout [“Test” (City)]
Show All Records
Sort Records [Specified Sort order:  City::Country; ascending 
City::City; ascending}
[Restore; No Dialog]
Set Variable [$varpath; Value: “filewin:” & Get(DocumentsPath) & “testfile.txt”]
Export Records [File Name: “$varpath”; Character Set “Windows (ANSI); Field Order: City::Country
City::City]
[No dialog]
Note again that the Get(DocumentsPath) when run server-side resolves to the Documents Folder in the root level of FileMaker Server.  FileMaker Server has permissions to read from and to write to that directory.  It may well not have permissions to read from or to write to other directories on the server machine.  Similarly the Get(TemporaryPath) when run server-side will resolve to the temporary subfolder created for the running script schedule.

Thus, developers wishing to use server side exports or imports must channel those actions through FileMaker Server’s Documents Folder or the Temporary folder.  Also note that the script above requires no user action through the User Interface.  The Go to Layout step is used to set the correct context based on the table alias from the Relationship Graph attached to the layout.  The layout does not have to have any fields placed on it.

We hope this explanation clarifies what is happening with this feature and that it helps developers utilize this important new feature correctly.

Wim and Steven

This post has been promoted to an article
Steven H. Blackwell
Platinum Member Emeritus, FileMaker Business Alliance
Platinum Member, FileMaker Business Alliance (2007-2011)
Partner Member, FileMaker Solutions Alliance (1998-2007)
Partner Member, Claris Solutions Alliance (1997)
FileMaker Certified Developer 7|8|9|10|11
FileMaker Authorized Trainer 9|10|11
_ _ ____________________________ _  _
http://www.fmp-power.com
http://www.filemakersecurity.com

#2 OFFLINE   mr_vodka  Candy is Dandy... But Liquor is Quicker

mr_vodka
  • Moderators
  • 5,605 posts
  • LocationCharlotte, NC
  • FM Client:12 Advance
  • FMGo:iPad
  • Platform:Windows XP
  • Skill Level:Expert
  • Certification:8, 9, 10, 11
  • Membership:TechNet, FileMaker Business Alliance
  • Time Online: 2d 17h 3m 54s

Posted 28 January 2009 - 02:01 PM

I am still curious to see if this works with system DSNs for ESS. Technically ifs its system wide, then permissions should not be an issue. If indeed the importing can only be done from these two locations, then FMI missed the mark high with this one. Just my 2 cents.
- John Ahn
Vodka Productions
FMfunctions.com, Co-founder

#3 OFFLINE   Steven H. Blackwell  Humble Servant

Steven H. Blackwell
  • Moderators
  • 4,388 posts
  • FM Client:12 Advance
  • Platform:Cross Platform
  • Skill Level:Authorized Trainer
  • Certification:7, 8, 9, 10, 11
  • Membership:FileMaker Business Alliance, FIleMaker Platinum Member
  • Time Online: 3d 17h 15m 45s

Posted 28 January 2009 - 02:15 PM

John, I don't know the answer for sure.  I have had one report to the effect that it did not work with ESS.  But more testing may be needed.  Perhaps we can test further.

Also, remember that this is likely a first step in this area.

Steven
Steven H. Blackwell
Platinum Member Emeritus, FileMaker Business Alliance
Platinum Member, FileMaker Business Alliance (2007-2011)
Partner Member, FileMaker Solutions Alliance (1998-2007)
Partner Member, Claris Solutions Alliance (1997)
FileMaker Certified Developer 7|8|9|10|11
FileMaker Authorized Trainer 9|10|11
_ _ ____________________________ _  _
http://www.fmp-power.com
http://www.filemakersecurity.com

#4 OFFLINE   bcooney  consultant

bcooney
  • Moderators
  • 5,207 posts
  • LocationLong Island, NY
  • FM Client:11 Advance
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10
  • Membership:TechNet
  • Time Online: 14d 15h 41m 11s

Posted 28 January 2009 - 02:26 PM

Just to clarify, when you say, "The import/export path cannot be dynamic when using the export or import feature on the server," do you mean that you CAN use $var as the import path, but it should point to a file (whose name can change) in the Documents folder?

I plan to receive XML files via FTPeek and will download them to the Documents folder on the server. I wish to import from them daily, but the filename will change. That's a variable path by my definition. Is this not possible?

#5 OFFLINE   mr_vodka  Candy is Dandy... But Liquor is Quicker

mr_vodka
  • Moderators
  • 5,605 posts
  • LocationCharlotte, NC
  • FM Client:12 Advance
  • FMGo:iPad
  • Platform:Windows XP
  • Skill Level:Expert
  • Certification:8, 9, 10, 11
  • Membership:TechNet, FileMaker Business Alliance
  • Time Online: 2d 17h 3m 54s

Posted 28 January 2009 - 02:29 PM

Hi Steven.

I havent had time to test it properly as well. I will have to agree though that the ability to server side import was to me one of the biggest reasons to upgrade to FMS10. (I am speaking generally and not personally since I get it through VLA maintenance) It just feels short. ESS is a great feature and for FMS not to have the ability to import from it just seems a little silly to me.

Most of the features in FM10 are worth an upgrade IMHO, however, I dont think I can say the same for FMS10. The next best part besides server side import is the MUCH needed ability to *simplify the backup / server side scripts; which was most definately appreciated. :
- John Ahn
Vodka Productions
FMfunctions.com, Co-founder

#6 OFFLINE   Baloo  journeyman

Baloo
  • Members
  • 205 posts
  • FM Client:10 Advance
  • :

Posted 28 January 2009 - 05:32 PM

Importing from as MySQL ESS to a FMP table via FSA10's automated scripting is working like a champ for me in a sandbox environment (the only place we've deployed 10 so far).

However now that server 10 allows for drop-downs based on ESS field values the question becomes:  What compelling reasons remain for running the imports and having to maintain duplicate data sets?
I'm always happy to help with PHP-API and/or general PHP questions, but I don't check this board as much as I used to. Feel free to PM me to ask me to look at a post. For the benefit of the group please post your question rather than asking via a PM.

#7 OFFLINE   mr_vodka  Candy is Dandy... But Liquor is Quicker

mr_vodka
  • Moderators
  • 5,605 posts
  • LocationCharlotte, NC
  • FM Client:12 Advance
  • FMGo:iPad
  • Platform:Windows XP
  • Skill Level:Expert
  • Certification:8, 9, 10, 11
  • Membership:TechNet, FileMaker Business Alliance
  • Time Online: 2d 17h 3m 54s

Posted 28 January 2009 - 05:45 PM

This is good news if there are no issues.

As for why its needed, there are some things that are just FASTER as a straight SQL import into FileMaker rather than trying to use ESS directly. Due to the way FileMaker's ESS engine is designed, if there is a very large database (such as Peoplesoft commonly is) it load the entire data dictionary which in essence cripples the ability to even use the relationship graph. ESS is great in most cases, but in some its virtually useless.
- John Ahn
Vodka Productions
FMfunctions.com, Co-founder

#8 OFFLINE   Wim Decorte  Pooh-Bah

Wim Decorte
  • Moderators
  • 2,316 posts
  • LocationPhiladelphia
  • FM Client:12 Advance
  • FMGo:iPhone / iPod Touch, iPad
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:7, 8, 9, 10, 11
  • Membership:TechNet
  • Time Online: 3d 8h 54m 37s

Posted 29 January 2009 - 02:55 AM

Yes, you are correct:  you can use a variable as the path & file name in the import/export setup.

But that path name should point to one of the two locations.

#9 OFFLINE   Steven H. Blackwell  Humble Servant

Steven H. Blackwell
  • Moderators
  • 4,388 posts
  • FM Client:12 Advance
  • Platform:Cross Platform
  • Skill Level:Authorized Trainer
  • Certification:7, 8, 9, 10, 11
  • Membership:FileMaker Business Alliance, FIleMaker Platinum Member
  • Time Online: 3d 17h 15m 45s

Posted 29 January 2009 - 04:53 AM

Barbara:

In addition to what Wim said, take a look at the new Get(DocumentsPathListing) function.

Steven
Steven H. Blackwell
Platinum Member Emeritus, FileMaker Business Alliance
Platinum Member, FileMaker Business Alliance (2007-2011)
Partner Member, FileMaker Solutions Alliance (1998-2007)
Partner Member, Claris Solutions Alliance (1997)
FileMaker Certified Developer 7|8|9|10|11
FileMaker Authorized Trainer 9|10|11
_ _ ____________________________ _  _
http://www.fmp-power.com
http://www.filemakersecurity.com

#10 OFFLINE   bcooney  consultant

bcooney
  • Moderators
  • 5,207 posts
  • LocationLong Island, NY
  • FM Client:11 Advance
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10
  • Membership:TechNet
  • Time Online: 14d 15h 41m 11s

Posted 29 January 2009 - 03:54 PM

Thank you Wim and Steven. I saw that new function, Steven, but FTPeek has a similar GetFileList which I use to grab the files in the FTP Incoming folder into a $var.

#11 OFFLINE   The Software Man  novice

The Software Man
  • Members
  • 19 posts
  • FM Client:10 Advance
  • :

Posted 27 February 2009 - 12:32 PM

So to get things right for importing on a MacOS X.

I have an xml exported file from FMP 6.0 that has been placed in the directory:
"Server HD:Library:FileMaker Server:Documents:MyFile.xml"

I then have a FMPS 10 script that only has one step:

   Import File[No Dialog; MyFile.xml; Add; Mac Roman]

where I have chosen MyFile.xml from the Choose File Dialog

However, this fails when run from the scheduler on the server with an error (100)

You state that the file to import needs to be in the Documents folder in the root FileMaker Server directory.

Just to be sure I wasn't mistaken even tried the user's documents folder:

"Server HD:users:admin:Documents:MyFile.xml"

What the heck am I doing wrong.

#12 OFFLINE   Steven H. Blackwell  Humble Servant

Steven H. Blackwell
  • Moderators
  • 4,388 posts
  • FM Client:12 Advance
  • Platform:Cross Platform
  • Skill Level:Authorized Trainer
  • Certification:7, 8, 9, 10, 11
  • Membership:FileMaker Business Alliance, FIleMaker Platinum Member
  • Time Online: 3d 17h 15m 45s

Posted 27 February 2009 - 01:18 PM

Do you need a style sheet to transform the file?  The grammars may not match.  Can you do this manually?

Steven
Steven H. Blackwell
Platinum Member Emeritus, FileMaker Business Alliance
Platinum Member, FileMaker Business Alliance (2007-2011)
Partner Member, FileMaker Solutions Alliance (1998-2007)
Partner Member, Claris Solutions Alliance (1997)
FileMaker Certified Developer 7|8|9|10|11
FileMaker Authorized Trainer 9|10|11
_ _ ____________________________ _  _
http://www.fmp-power.com
http://www.filemakersecurity.com

#13 OFFLINE   bcooney  consultant

bcooney
  • Moderators
  • 5,207 posts
  • LocationLong Island, NY
  • FM Client:11 Advance
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10
  • Membership:TechNet
  • Time Online: 14d 15h 41m 11s

Posted 27 February 2009 - 02:30 PM

I would say that you need to go to a layout based on a table occurrence of the table that you wish to import the records before your Import Records. If you show the Import Mapping dialog, are you seeing proper field mapping, and records? If not, then it's probably that you need a stylesheet.

#14 OFFLINE   The Software Man  novice

The Software Man
  • Members
  • 19 posts
  • FM Client:10 Advance
  • :

Posted 27 February 2009 - 03:33 PM

Well, the script worked Manually, but I will forgo the xml travails. I will use .xls format. And to make ensure compatibility, I manually exported sample data from the same file that I want to import to.

I changed the script to:

go to layout["my big layout" (mydetails)]
set variable[$varPath; Value: "filemac:" & get(DocumentsPath) & "details.xls"]
import records[No Dialog; Source: $varPath; Worksheet ""; Add; Mac Roman]

I place a copy of the file in both directories:
"Server HD:Library:FileMaker Server:Documents"
and
"Server HD:Users:Admin:Documents"

I still get an error
scripting error (100) at "Details: Import Daily: Import Records"

I know that some of you have tried this on a Wintel server, anyone done it on a MacOS server?

And thanks again for the prompt responses.

#15 OFFLINE   The Software Man  novice

The Software Man
  • Members
  • 19 posts
  • FM Client:10 Advance
  • :

Posted 27 February 2009 - 03:39 PM

I even tried to be tricky. To debug the problem I added an export records to the script. That way the import is accessing the same file.

go to layout["my big layout" (mydetails)]
set variable[$varPath; Value: "filemac:" & get(DocumentsPath) & "details.xls"]
export records[No Dialog; "$varPath"; unicode (UTF-16)]
import records[No Dialog; Source: $varPath; Worksheet ""; Add; Mac Roman]


Still get an error (100) on the import records.

#16 OFFLINE   bcooney  consultant

bcooney
  • Moderators
  • 5,207 posts
  • LocationLong Island, NY
  • FM Client:11 Advance
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10
  • Membership:TechNet
  • Time Online: 14d 15h 41m 11s

Posted 27 February 2009 - 04:15 PM

Can you set a field to $varPath, so that you can see what path the script is using?

/MacintoshHD/Library/FileMaker Server/Data/Documents in the Mac OS

is the directory that the file should be in. This is how Get (DocumentsPath) evaluates on FMS. How about using "file:" instead of "filemac:"? Or, set $varPath to "file:" & Get(DocumentsPath) & "/details.xls"


omg-Could this be it?! You need a "/" before the file name.
So, "file:" & Get (DocumentsPath) & "/details.xls"

#17 OFFLINE   The Software Man  novice

The Software Man
  • Members
  • 19 posts
  • FM Client:10 Advance
  • :

Posted 28 February 2009 - 09:20 AM

As suggested I set a field to fill with the $varPath.

It computed to

filemac:/Server HD/Library/FileMaker Server/Data/Documents/myfile.xls

However, no export file ever shows up there.

#18 OFFLINE   bcooney  consultant

bcooney
  • Moderators
  • 5,207 posts
  • LocationLong Island, NY
  • FM Client:11 Advance
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10
  • Membership:TechNet
  • Time Online: 14d 15h 41m 11s

Posted 28 February 2009 - 10:37 AM

OK, so the path is correct. No export file could mean no found set when exporting. So, make sure that you have one.

Edit: I just had to test this..and it worked just fine. What I noticed, though, is that on my iMac FMS10 server, I had to "refresh" the Documents directory before I saw the file although it was there by then. I also sent myself an email, and that worked too.

My script:
Go to Layout ["Table"]
Show All Records
Set Variable [$path; Value:"file:" & Get(DocumentsPath) & "/test.xls"]
Export Records [No dialog; "$path"; Macintosh]

As I was setting this up, I was asked which Account to use when running this script. So, check that the Account that you are using has Export privs.

What's in the log?

Another thought: There are two Documents folders;

/MacintoshHD/Library/FileMaker Server/Data/Documents
  and
/MacintoshHD/Library/FileMaker Server/Documents

#19 OFFLINE   Chris Robot  novice

Chris Robot
  • Members
  • 8 posts
  • FM Client:10 Advance
  • :

Posted 30 March 2009 - 11:47 AM

This really helped. I was banging my head on the desk trying to figure this out.

Is it possible to update the original post with mention that there are two "Documents" folders in the FileMaker Server Directory (at least on MacOSX server.)

/MacintoshHD/Library/FileMaker Server/Data/Documents
and
/MacintoshHD/Library/FileMaker Server/Documents

In this case, you can write to .../Data/Documents and you can't write to .../Documents .

Thanks!

#20 OFFLINE   Steven H. Blackwell  Humble Servant

Steven H. Blackwell
  • Moderators
  • 4,388 posts
  • FM Client:12 Advance
  • Platform:Cross Platform
  • Skill Level:Authorized Trainer
  • Certification:7, 8, 9, 10, 11
  • Membership:FileMaker Business Alliance, FIleMaker Platinum Member
  • Time Online: 3d 17h 15m 45s

Posted 30 March 2009 - 01:11 PM

Get(DocumentsPath) should return the correct directory.  Are you saying that it did not?

Steven
Steven H. Blackwell
Platinum Member Emeritus, FileMaker Business Alliance
Platinum Member, FileMaker Business Alliance (2007-2011)
Partner Member, FileMaker Solutions Alliance (1998-2007)
Partner Member, Claris Solutions Alliance (1997)
FileMaker Certified Developer 7|8|9|10|11
FileMaker Authorized Trainer 9|10|11
_ _ ____________________________ _  _
http://www.fmp-power.com
http://www.filemakersecurity.com


Back to FileMaker Server


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

FMForum Advertisers