Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

"Insert from URL" to insert PDF on FM Server

Featured Replies

I am running a script on server (perform script on server) which successfully exports data to a PDF on the server ("Save Records As PDF"). Later in the script, I am trying to insert this PDF file into a container, using the "Insert from URL" script step.

No matter what I do, I am always getting back errors. 

FM server is running on a Mac server.

I have tried all combinations of different parameters for "Insert from URL", with various formats for the URL (starting with “file”, “filemac”, followed by “:/”, “://”, “:///”).
Depending of the combination, I am getting either one of these errors back:

5 - Command is invalid (for example, a Set Field script step does not have a calculation specified)
1630 - URL format is incorrect
1631 - Connection failed

Help how to resolve this and successfully insert the PDF into the container field would be appreciated. Thank you.

 

See if something like this works:

"file://" & Get ( DocumentsPath ) & "fileName.pdf"

 

  • Author
45 minutes ago, Josh Ormond said:

See if something like this works:


"file://" & Get ( DocumentsPath ) & "fileName.pdf"

 

Thank you Josh.

I already have a path generated where the file gets exported to in "Save Records As PDF", which works perfectly. That path begins with "filemac:/". Like I mentioned, I tried all combinations between "file:", "filemac:" and ":/", "://", and ":///". 

To insert a file from URL, you need a URL using the file protocol, not a Filemaker path. In macOS such URL will typically look like:

"file:///Users/YourUserName/Documents/YourFile.pdf"

which is different from what you would get from a calculation using 

"file://" & Get ( DocumentsPath ) & "YourFile.pdf"

 

11 hours ago, jschudel said:

I already have a path generated where the file gets exported to in "Save Records As PDF", which works perfectly. That path begins with "filemac:/". Like I mentioned, I tried all combinations between "file:", "filemac:" and ":/", "://", and ":///". 

If you use a path like @comment pointed out, it will work. I typically use a custom function for this process that handles the path for me, and I neglected to show the adjustment to the path. But it does work with that path he showed.

 

"file:///" & 

Let ( 

[

path = Get ( DocumentsPath ) ; 
transformPath = Substitute ( Get ( DocumentsPath ) ; "/" ; "¶" ) ; 
listCount = ValueCount ( transformPath ) ; 
adjustedList = MiddleValues ( transformPath ; 3 ; listCount - 2 )  ; 
newPath = Substitute ( adjustedList ; "¶" ; "/" ) ; 

result = newPath

] ; 

result

) & 


"fileName.pdf"

 

That's a long calculation - I would reduce it to:

"file:///" 
& 
Replace ( Get ( DocumentsPath ) ; 1 ; Position ( Get ( DocumentsPath ) ; "/" ; 1 ; 2 ) ; "" )
&
"fileName.pdf"

Still, it needs to be pointed out that this is specific to the Mac platform.

 

  • Author

@Josh & @comment. Thank you guys! Worked like a charm now that I finally understood that the URL has to have a different format! 

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.