exactly what happens when you run the script with sharing turned on? When you turn sharing on and test this script, are you running the script from the host computer or from a computer that connected to the database via Open Remote?
Are the fields being modified fields with global storage enabled?
Does $Filepath contain a path to a file on the computer where you are testing this script or a shared directory elsewhere on your network?
When I run the script from the host computer and sharing is turned on all of the fields except the one gets updated.
No global storage.
The $FilePath contains a path to the host computer where I am testing the script.
The only difference is turning shareing off or on. If on no update of the one field all the others are updated. If sharing off all of the fields update great.
Which field? Rwellsimages::Thumbnail?
GetThumbnail is a new function with FileMaker 12. I just looked it up in help and am suprised that it works at all in this script, sharing or no sharing. The help file indicates that the first parameter should be the name of a container field, there's no indication that a variable containing a file path can be used.
BTW, on a completely differnet note, FileMaker text comparisions are not case sensitive. Your check for a "lock" can just look for "L" or just "l", it does not need to test for both. What you have doesn't introduce any errors but if you assume such comparisions are case sensitive in another script, it might result in an error.
Is there another method to get a thumbnail into the container field?
Please note that this is a new function. All I've done with it to date is to read the help entry on it.
The help entry on the first parameter:
"any text, number, date, time, timestamp, or container field; or any text expression or numeric expression."
Seems a bit vague. A thumbnail of a date field? What would that produce? A text expression that evaluates as a container format file path? (That's what you have) or a text expression that evaluates to the name of the field? (What I thought when I first read this, but now I don't think that's the case.) I can see where you have code to create the container style file reference. Thus, what I'm pointing out here may not be the source of your trouble.
Next thing for me to do is play with the function in a test file and see what I get.
Have you tried testing this with the debugger (requires FileMaker Advanced)? or by using a show custom dialog to display the contents of $FilePath? Even if the fact that sharing is turned on is the culprit here, checking that detail and ruling out any filepath issues will be an important detail in turning this into a bug report for FileMaker techs to examine.
You might need to first insert the image file into a container field--this can be a global field if you don't want to keep the image file inserted a permanent basis and then use this function to extract a thumbnail from it. At the very least, this insures that your filepath is correctly formatted in the form needed for this function.
I'm back after doing a few tests.
Your syntax looks correct as I can put the container format filepath into a variable and use it to put a thumbnail into a container field. I then turned on file sharing and repeated the test. The script still put the thumbnail into the container field. I am testing on a windows machine, so this could be a mac specific bug, but I'd very carefully check the data in your filepath first to be sure that an error there didn't creep in.
Here's how I tested it.
I inserted a jpeg into a container field using Insert Picture/Store a reference.
I had a calculation field, cContainerText set to return text with the name of the container field as its sole term. This allowed me to easily get a correctly formatted file path for my test.
I then defined a text field named "text" so I could select text in cContainerText and copy/paste it into the text field.
My test script was then this two line script:
Set Variable [$Path ; value: ThumbNailTest::Text ]
Set Field [ThumbNailTest::ThumbNailContainer ; GetThumbNail ( $Path ; 500 ; 500 ) ]
Whether sharing was on or off did not keep this script from working as long as a valid, correctly formatted filepath was stored in Text.
I am using a Mac as you can tell. I am running Filemaker Pro and do not have the ability to debug.
I have another script when I run it causes the same proble with the above script. It is a script that runs 2 applescript to reterive and update metadata using exiftool. I can not make it fail as consistant as the the share on or off. Next week maybe I can give it another try to see if I can make it fail consistantly.
BTW how do you post code snippits? I can not get Filemaker Pro to do a cut and paste.
BTW how do you cut and paste a code snippet to the forum? I can not get Filmaker Pro do cut and paste.
Without advanced, you can put show custom dialog into your script as a temporary test and put the variable into the message box of the dialog.
For short bits of code and many longer ones when I I am composing the example on the spot as a suggested solution, I just type them. (Shift return single spaces text when typing into Post A Answer.)
But you can also post scripts using any of these methods:
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
- If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
BTW, you are welcome at any time to click on the Report an Issue tab at the top of this screen and post this as a bug report. If you do so, you can save typing by posting a link to this thread in your issue report.