Skip 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.

Open Referenced File in Container

Featured Replies

I hope this isn't obvious but I have a container that only store a reference to the file. If I double click on the container the file opens but how can I set a button to open the file. I'm not seeing anything in Script Maker to let me do this, I see lots of way to insert files into a container but no way to open them.

See if this helps:

http://forum-en.filemaker.com/fm/board/message?board.id=FM-en-4&thread.id=22902

  • Author

Thanks comment you always seem to have a suggestion and its greatly appreciated.

However this didn't work for me because I tried to simplify the question. I could also be complicating a simple problem so here everything. This isn't too complicated but there are a couple details you might find useful. The solution has to work cross platform.

All files go into one directory on a server.

I noticed that when I insert a file reference into a container that the path is specific to the platform that inserts the file. (Tested via the "GetAsText ( File )" ["File" is my field name] The results of GetAsText (File) looks like this on window and slightly different on a Mac.


file:filename.txt

filewin://host/Shares/filedirectory/filename.txt







Using a calculation (which results in a text field) I'm able to set the path and file name. Here is my calculation.  Hope it doesn't look to scary.



Let ( 

[$path = Case ( 

Get ( SystemPlatform ) = "-2"; "filewin://host/Shares/filedirectory/" ; 

Get ( SystemPlatform ) = "1"; "filemac:/Shares/filedirectory/" ; "error" ) ;



$file =Replace ( GetValue ( File ; 1) ; 1; 5 ; "" )]



; $path & $file )

The results of this calc look something like "filewin://host/Shares/filedirectory/filename" or "filemac:/Shares/filedirectory/filename"

So in the end I have a text field with a full path to the file for either platform but since its not a container I can't actually double click on it but was hoping to have a script step that would open the file.

FYI: this is done with two fields "File" is a container field

File_Path is the calculation resulting in text.

Edited by Guest
additional information.

I am not sure I follow the issue here.

I have a text field with a full path to the file for either platform but since its not a container I can't actually double click

Why can't you double-click the container field itself - either directly, or through a script?

  • Author

If the file reference is stored while using XP or Vista the path is different than if it is stored using OS X.

If the user double clicks the contain from the opposite platform the file will not open, the directory is not found.

Are you sure about this? I would think that if the container has sufficient information to display the file, it should also know how to ask the OS to open it when double-clicked. Or are you saying that the file doesn't always show in the container?

  • Author

I'm not storing the actual file in FileMaker only storing a reference/pointer to the file on a server. I've tested everything multiple times and it does not work. When using the GetAsText to see the path they are different.

Maybe its in the way our server is configured. But I've attached a pretty simple file you can test with.

The files I'm using are stored on a Window server.

Thank you for your efforts.

I am getting more and more confused here. In your original post, you said:

If I double click on the container the file opens but how can I set a button to open the file.

The suggestion I linked to is to make the button run a script:

Freeze Window

Go to Field [ YourTable::ContainerField ] [ Select/perform ]

Go to Field [ ]

I don't see how GetAsText() comes into this.

  • Author

Read the 3 post to this thread were I gave much more detail.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.