Jump to content

Help with ConvertFromFileMakerPath


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

Recommended Posts

Hi everyone,

I want to use a webviewer to play mp3 and mp4 files but I can't manage to construct the right path to the external drive where those files are stored. I have hundreds of records each with its own mp3 or mp4, so I guess the way to access the right mp3 or mp4 from the right record would be to use the ConvertFromFileMakerPath function in the webviewer calculation. Amongst other things, I've tried this calculation: ConvertFromFileMakerPath ( "filewin:/G:/VIDEOS/"; URLPath ), but it's obviously the right approach. And frankly I'm lost as to how to construct the right path.

Could anyone help?

Thanks.

 

Link to comment
Share on other sites

1 hour ago, The Learner said:

it's obviously the right approach.

Hard to tell from your description. To answer your question, we would need to see an example or two of the original path as stored in your record, and the expected resulting path after the conversion. You can tell what the resulting path should look like by dropping one of the files located on the external drive into a browser window and observing the browser's address bar. 

 

Edited by comment
  • Plus1 1
Link to comment
Share on other sites

Thank You,

right now the paths are stored in a container field in each record. It worked fine until the last upgrade to FM 19.3.2.206, now the container field no longer works so I'm not sure how to find an example of the path as stored in the record. It looks like the path to the external drive is no longer recognized. It's not the first I've had a similar issue following an upgrade so I thought switching to a webviewer approach would resolve this issue for good. 

Here are two examples as produced by dropping the files in a browser:

file:///G:/VIDEOS/230.%20Back%20to%20the%20Beginning%20(28-12-2012).mp4

file:///G:/VIDEOS/166.%20Guatanamo%20(18-10-2012).mp4

 

 

Link to comment
Share on other sites

Here are the paths as stored in the record:

movie:230. Back to the Beginning (28-12-2012).mp4
moviewin:/G:/VIDEOS/230. Back to the Beginning (28-12-2012).mp4

movie:166. Guatanamo (18-10-2012).mp4
moviewin:/G:/VIDEOS/166. Guatanamo (18-10-2012).mp4

Link to comment
Share on other sites

These paths look like they point to the correct location . What exactly "no longer works" with the container field?

In any case, if you want to display the files in a web viewer, you could do one of the following:

(a) convert the last path stored in the container field to a URL path - but this will only work if the stored path is indeed correct;

(b) extract the filename from the container field and append it to the path to the VIDEO folder - but this will only work if all files are at the top level of the VIDEO folder.

To do (a):

ConvertFromFileMakerPath ( GetValue ( YourContainerField ; ValueCount ( YourContainerField ) ) ; URLPath )

To do (b):

Let ( [
pos = Position ( YourContainerField ; "/" ; Length ( YourContainerField ) ;  -1 ) ;
filename = Replace ( YourContainerField ; 1 ; pos ; "" ) ;
folderpath = "file:///G:/VIDEOS/"
] ;
folderpath & filename
)

If this is successful, you could place the folder path in a global field and reference it in your calculation instead of the hard-coded string. This would allow you to easily move the files to another location.

All of this is untested.

 

Link to comment
Share on other sites

Thank You,

Just tried your first option and its works fine, which means as you say that the stored path is indeed correct. Which begs the question as to why the container field no longer works. Below is a screen capture of that container field. It's black with an arrow at the bottom and no other video controls, and nothing happens when I open the record. 

What in your view is the best approach to this in terms of long-term stability and avoiding hassles when upgrading: container field or webviewer?

Container.PNG

Link to comment
Share on other sites

5 minutes ago, The Learner said:

It's black with an arrow at the bottom and no other video controls, and nothing happens when I open the record. 

I don't know that anything is supposed to happen when you open the record (unless you have a script trigger to make something happen). I rarely work with container fields, and even more rarely with videos in container field. Doesn't clicking the triangle make it play?

9 minutes ago, The Learner said:

What in your view is the best approach to this in terms of long-term stability and avoiding hassles when upgrading: container field or webviewer?

IMHO Filemaker interactive container fields are not yet mature technology. My tendency would be to store the filename (and if applicable, the path from the master folder to the file) in local text fields, and the path to the master folder in a global field. Then you have full flexibility: you can move the entire collection to another location and change only one field; and you can choose to display the files in a web viewer or in a container field populated by a calculation. But there are other options to consider, e.g. letting Filemaker manage the external storage: https://help.claris.com/en/pro-help/content/store-data-externally.html

 

Link to comment
Share on other sites

I meant to say I can't do anything with that arrow. It's frozen. Any idea what could explain why this container field is not working?

As for the rest of your comment, my FM abilities being quite limited, I'll have to see if I can implement your suggestions. For instance, for the already existing records, how do I proceed to store filenames in local text fields and the path to the master folder in a global field? 

And speaking of external storage, I do have one DB that contains over 7000 photos and videos in external storage. The container field no longer works in that case either. Can solution (a) above be tweaked to deal with this?

I guess the easiest would be to find a way to have this container field work as it used to.

Thanks a lot for your time. I would never have been able to resolve any of this on my own.

Link to comment
Share on other sites

6 minutes ago, The Learner said:

Any idea what could explain why this container field is not working?

I am afraid not. As I said, I rarely work with videos in container fields. And I am still on v.18.

I would suggest you try and see if the problem can be reproduced in a brand new file. If so, report it as a bug.

9 minutes ago, The Learner said:

how do I proceed to store filenames in local text fields

Show all records, click in the (newly added) Filename field and select Records > Replace Field Contents… > Replace with calculated result =

Let ( 
pos = Position ( YourContainerField ; "/" ; Length ( YourContainerField ) ;  -1 ) 
;
Replace ( YourContainerField ; 1 ; pos ; "" )
)

Make sure to have a backup before you try this, as there is no undo if you make a mistake.

16 minutes ago, The Learner said:

and the path to the master folder in a global field? 

Just paste or type G:VIDEOS/ into it.

Then, for a web viewer (or a browser, if you want ) use:

"file:///" & gFolderPath & Filename

and for a container field:

"movie:/" & gFolderPath & Filename

 

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

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