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.

Find existing referenced Container & reimport as embedded

Featured Replies

Hello

For quite sometime I have been trying, in vain, to get round a (in my opinion) completely redundant FM server issue concerning referenced files in subfolders and servers. I have 20,000 pix that I (with the inestimable help of many of you in this forum) set up in an FM db many years ago. At the time, the thinking was that pix should be referenced to keep FM file sizes down & therefore speed up the searches. Then I discovered IWP and recently PHP and in both cases I have discovered that the server will only see containers elements that are either embedded or referenced in the same folder as the file. As having a folder with over 20,000 pix is not very motivating and to get to that point I will have to reconnect all the files, I have waiting, (in vain) with FM to deliver a FMSA version that sees sub folders (I hope that someone will prove me wrong & tell me how I can get it to work with out changing anything).

In the meantime, does anyone have a script that can parse out the referenced files and automatically reinsert the file as an embedded file without changing any of the ID numbers etc?

Even better, does anyone know how to get round this referenced file problem?

Any suggestions are greatly appreciated.

GetValue ( GetAsText ( yourContainer ); 3 ) will give you the path to where the referenced files will be. If you set that to a variable such as $path, you can then insert picture with the path set to your variable. Do not check the store as reference only to embed it. You can write a loop that automates it for all your records.

  • Author

Thank you mr vodka for your spirited reply (dreadful pun, I know). I don't quite understand what the variable does & how does the referenced file become embedded?

I mean execute a script with something like this....

Show All Records

Go to Record [First]

Loop

Set Variable [ $path; GetValue ( GetAsText ( yourContainer ); 3 ) ]

Insert Picture [$path]

Go to Record [Next; Exit after last]

End Loop

Commit Record []

  • Author

Thank you again for the script. It does not work for me for the moment but it has helped me understand how FM works.

My question is that I have a field (picture attached ) that has ContainerFieldName which is a GetAsText calc. It throws up all this info:

size:500,337

image:../../pmworld/PMWORLD/PMWORLD DECORS/ARCHIVE DECORS/2-PARIS/CAFE FLORE - 75005/cafe_flore_bd.jpg

imagemac:/POWERBOOKG4HD/Users/pmworld/PMWORLD/PMWORLD DECORS/ARCHIVE DECORS/2-PARIS/CAFE FLORE - 75005/cafe_flore_bd.jpg

I presume that all this info needs to be parsed out so that it can read the real useful address and therefore change it. Is this an issue and if so, what do I need to parse it?

Which gets me thinking ... Can a script be used to rewrite the above address so that it is right for my server machine so therefore the server will be able to display the picture?

Well yes, you can copy the files to a served location and then update all the container fields with the new path to the served location. If you have the structure similar to what you currently have, I would create a second container field to store the new referenced file location.

David gave you a parsing method:

Set Variable [ $path; GetValue ( GetAsText ( yourContainer ); 3 ) ]

Unfortunately (for you*), GetValue() came out in FileMaker 8. But you can use:

RightValues ( GetAsText ( yourContainer ); 1 )

*Please update your profile if you are no longer using FileMaker 7.

Edited by Guest

I dunno about David }:( , but the orig post stated he has FM9 Advanced.

I think the OP missed something. Perhaps he has a hybrid of images with references and those already embedded.

Show All Records

Go to Record [First]

Loop

If [ ValueCount ( GetAsText ( yourContainer ) ) = 3 ]

Set Variable [ $path; GetValue ( GetAsText ( yourContainer ); 3 ) ]

Insert Picture [$path]

End If

Go to Record [Next; Exit after last]

End Loop

Commit Record []

  • Author

thank you for all your help. I am on FM9. As I know nothing, I presume that the 3 in

Set Variable [ $path; GetValue ( GetAsText ( yourContainer ); 3 ) ]

refers to the 3rd line of the GetAsTEXT.

My db is partly embedded and much more referenced, therefore complicating the problem. So the new question is; what does the new line

If [ ValueCount ( GetAsText ( yourContainer ) ) = 3 ]

do?

Also, maybe you are php or xml specialists but if the db has embedded pix in the container field, I presume that there is no way of extracting the pix to be used as part of a server solution?

  • Author

Last question: How does the script tell the machine to embed the re-inserted file?

  • Author

Mr Vodka,

I can smell the glory of your script but can't taste it yet. Truth be told, the script does not work yet. In the debugger, I can see the file address is extracted but the insert command does not work. I presume that $Path is script short hand for, take the path you have memorised and apply it. I have tried with or without referenced files, without success. Any ideas please?

[color:red]Update your profile to the current version you are using

  • Author

It is done.

Except you can't run FileMaker 9 on Jaguar :-|

If you saw the path correctly in Debugger (exactly the same as the 3rd line of GetAsText (container)), set into the $Path script Variable, how are you entering it as the path for Insert? It's just: $Path

No quotes.

  • Author

I was never very good on big cats. 10.4.11 - whatever the feline is.

I don't understand what you are asking. I have copied exactly what was written ... I think. A picture is attached.

Picture_2.png

To change the cat to Tiger, all you need to do is to go to My Profile >> Your Control Panel >> Public Profile

Select "Platform" and select Tiger.

HTH

Lee

There is a step missing in the script. Which crossed my mind at some point, but must have leaked out again :-]

It is something that you'd notice immediately if you tried to Insert manually.

Which is that you have to be IN the container field first. Insert has no option to select the field. So, before using Insert, use the script step: Go to Field [ your container field ]

[P.S. The field does not have to be "user-enterable" on the layout; the script can still enter it.]

Edited by Guest

Ah good catch Fenton. Apologies for not double checking the script after typing it.

Edited by Guest

  • Author

Gentlemen, I tasted the vodka and it was sweet. Thank you.

To resume for those who want a script to make referenced container files embedded (so web publishing for example), that works for me under FMA 9:

Show All Records

Go to Record [First]

Loop

If [ ValueCount ( GetAsText ( yourContainer ) ) = 3 ]

Set Variable [ $path; GetValue ( GetAsText ( yourContainer ); 3 ) ]

Go to Field [ your container field ]

Insert Picture [$path]

End If

Go to Record [Next; Exit after last]

End Loop

Commit Record []

I think you need to create a new container field, say, "Referenced Pictures," then go to that field before inserting the picture.

Show All Records

Go to Record [First]

Loop

If [ ValueCount ( GetAsText ( yourContainer ) ) = 3 ]

Set Variable [ $path; GetValue ( GetAsText ( yourContainer ); 3 ) ]

Go to Field[select/perform;Referenced Pictures]

Insert Picture [$path]

End If

Go to Record [Next; Exit after last]

End Loop

Commit Record []

Otherwise, Filemaker doesn't know what field to put it into.

Hope that helps!

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.