Jump to content
Server Maintenance This Week. ×

Calculating a container field

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

Recommended Posts

Sorry if this post has been covered as I'm sure it has, since it seems like a common task, but I've searched and can't find the answer.

I'm trying to calculate a reference link for a container field, where I want to have a image appear in my FileMaker Database based on a link that is calculated. The link is a URL, as I want the link to work both for client access in FileMaker and for my CDML. The calculation looks like this "http://website/directory/"&photoname&".jpg" with the result being a container.

What is the method for creating a container field based on file path that is calculated in FileMaker?

I've tried this as an auto enty calculation and as defined field calculation... neither work, but like I said the result works if I do it manually.

I can calculate a container field as long as result in the calculation is an existing container field.. ie. a global field that is container and has a color or image in that I want to use to automate a graphic, but I can't seem to calculate a file path to an image, which I would think would be a very common practice.

Appreciate the help!

Link to comment
Share on other sites

FileMaker Pro, not being a browser, has no inbuilt means to retrieve data or images of any kind from http addresses.

Container fields are able to store (or reference) and display images which are available on local disks (ie mounted volumes accessible to the operating system), but even these cannot be referenced by calculation, and must be imported either manually or by script.

There is some possibility that you may be able to write a script to do something along the lines of what you are imagining, but if so, it is going to require a plug-in to achieve it.

The new Troi URL plug-in has some HTTP capabilities, but I suspect that you will find that it is limited to retrieval of data, rather than files and images.

If the jpg images you are trying to display are available via ftp, then there is a chance that you might be able to access them using the FTPit plug-in from CNS, however you will not be displaying online data, but instead retrieving the data first and then accessing/displaying a copy of it from a local drive.

Depending on what platform and system version (and FileMaker version) you are using, there may be other plug-ins that you could consider. I suggest that you take a look through the plug-in listings on sites such as http://www.fmplugins.com/

to see if you can locate something suitable. It is a long shot.

Link to comment
Share on other sites

Thanks for the response!

At the moment I created a work around by adding a button with an open URL script command, which kinda works but is not what I'm trying to get to.

I think I must have the wrong approach, so before I go to deep into your options I think it best to add some detail to my dilemma.

Ultimately what I'm trying to do is create a way so images can be added to the database via client access AND from the web with CDML, where the images can be viewed both from a browser and from the client.

I'm using FileMaker Pro 6, and looking over the forum I found that container fields cannot be managed from the web, and that the method for uploading images via the web is by uploading images to a directory that the server has access to. This I can do with ActiveX, ASP, or a number of other methods, so thats not the issue.

So far I cannot find anything that explains how images in a folder once uploaded can be linked and viewed in a record. I thought my method of calculating the path to the image would work, AND it seems FileMaker CAN have a URL as a referenced link to a container thus the path does not need to be local to the server or local network.

There is an Insert Picture script command, but it requires you establish a static path.... if the path could be calculated my problem would be solved

What I trying to do must have been done hundreds or thousands of times, but its frustrating not finding the solution. My platform is Windows.... I think I could probably do this with AppleScript, but I do not have the option as the client is running Windows 2K.

So my question is: Is there a preferred way, regardless of how technical and tedious to allow images to be added and viewed in a database both by the client and web (via CDML) under a Windows platform?

Thanks again for your detailed response..... a solution probably exists in some book somewhere, but I'm under time constraint, thus I truly appreciate the help!

Link to comment
Share on other sites

I have solved my problem. Here is what I did, if anyone is interested.

I used the Import Folder items included with FileMaker 6, but as Cobalt Sky explained above the Troi file grabber plug-in can do the same thing for FMPro 4 or 5

For this to work effectively I created a related database just for photos, and established an import routine and script to import all items in a folder local to my server (theres a trick to doing this, when specifying the folder you need to set the file type to "folder" in the file type drop down after the dialogue opens, then you can select the folder path)

When importing I matched the name of the files in the folder to the Name field of the photos database. I then related this field to PhotoName in my original database. PhotoName is calculated to create a name of the photo to be the ID.jpg or "noimage.jpg" depending on whether the image status is uploaded or not. In otherwords the name of the photos added to the folder are named to match the record ID, with the exception of one image that is used a placeholder if no photo is uploaded.

I then could add the photo container from the related photo database to my layout in my original database which allows me to view the appropriate photo for that record. As many records will not have photos, but instead have the "noimage.jpg" as the photo you can understand why I created a seperate FM database for this. Photos in the folder are not one to one with records in my database, I could have 30 images in a folder and a 100 records.

In my original database I added a button to refresh photos which runs an external script to the photo database to re-import images from the folder. I set this to run without any dialogues and it updates matching images and adding new ones that were added to the folder.

The folder the images are in is also a web folder, so as I originally had done, I calculated the URL to the photo and use this to display the images in a browser via CDML.

I could have used the container field for this however I would need to run the refresh photos script after images are uploaded from a web form to the web folder, and I thought this a simpler way to accomplish it for the web.

So far works pretty well and is very simple to do... challenging to discover.... but simple to do.

Hope this helps anybody else looking to do the same thing.

Link to comment
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

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