Hi there, apparently it is possible to create a Data File from a script run by FMS then import it via Insert From URL script step.
How does the URL path look like for this to succeed for both mac and windows?
I tried without success the following: (from what I found online).
A also tried
ConvertFromFileMakerPath ( Get ( DocumentsPath ) & $fileName ; URLPath )
Hi, FMS could only access document folder or temporary folder or child of the above folders as stated as following
Maybe you could try the above paths first?
Thanks! Sorry I don't get it. I am using a legit path as explained aiming at the documents path and it is written properly which I veryfied. I need to reimport it via InsertFromURL script step where it fails.
Here is what I found which is explains my situation. A bug?
Important behaviour change - should be in release notes - possible bug (claris.com)
So you are using FMS20? What error have you got? Is that possible to test your script before 19.6.1?
Hi @barefoot ,
When it fails, is there an error code that you are capturing via Get( LastError ) which you can share here? That could help everyone reading this thread be better able to assist.
I'll note that one common gotcha with Insert From URL used to be that, if you are inserting into a field (as opposed to a variable), then that field needs to be present on the layout where the insert is happening. It's possible that this could have changed, but I don't recall that being the case. Perhaps someone else can chime in to confirm/refute that. It's definitely something that has tripped up a lot of developers in the past.
The documents folder that is accessible to Server is limited to the server's document folder. The path to this folder looks like this:
/C:/Program Files/FileMaker/FileMaker Server/Data/Documents/ (Windows)
/Macintosh HD/Library/FileMaker Server/Data/Documents/ (macOS)
While the path may vary from the above, my point is that the server's Document folder is not a user Document folder. Server is unable to access a user's Document folder or the Desktop folder contained in it.
Hope this helps.
That is a real gotcha, and a bewildering requirement.
@barefoot you say FMS20. What is the server environment. Is it self-hosted or Claris FMCloud. If self-hosted what OS is the server running?
Thank you very much @steve_ssh all very helpful to check!
I got it to work by using ConvertFromFileMakerPath ( $FilePath ; URLPath ) which added the prefix as desired: file:/// and was able to insert into the field on the layout. I tried the same path to insert into a variable $target without success and error 507 // "Value in field failed calculation test of validation entry option".
This is all currently running not server-sided and hopefully if resolved it can be performed on server. Thanks again!
it is all on latest and greates FM20.2.1 and MacOS 13.6.1 to be later moved to Windows 2019 Server and FMS20.2.1
That error is weird because it is inserted into a variable where no field validation happens. That variable $target is also not used in any field validation calculation. Pretty mind buckling.
Thanks to Alex Zueiv he told me how to get it to work here: Claris Community (English)
// The solution is to add the cURL option header: "--FM-return-container-variable"
Thanks very much for posting the solution here, @barefoot .
That header does ring a bell, but it is not something that has stuck in my memory. I appreciate you taking a moment to share it here.
Confessing: I spent hours on this mislead by Error 507 and it seamed to my limited mind counter intuitive that just switching from container field to target variable would fail me as it did. Glad Alex knew!
Here is the documentation, keep it handy for those times when Alex isn't available.
Sometimes I think Alex is a FileMaker savant. So many smart and super-helpful people here, and in the FM Community at large.
Although I've been developing FM solutions since v4 or v5 (once Microsoft [edit: bought and] killed support for FoxBase+/Mac) I still learn something every day from the FM Community. Maybe something I don't need right now, but it sure keeps my bookmarks well populated.
Alex Z is a total BAMF. It's getting ridiculous.
BAMF = Best Acclaimed Mastering FileMaker