FMP 10 Adv:
I don't want users to store only a reference to a chosen file, not the
file itself. Is there a way to calculate what's in the container field.
And, while we're at it, the size of the referenced file?
--
http://clk.ch
|
|
0
|
|
|
|
Reply
|
clk951 (148)
|
1/7/2011 4:16:07 PM |
|
"Christoph Kaufmann" schreef in bericht
news:1juqigi.13kcy841owaal8N%clk@tele2.ch...
FMP 10 Adv:
I don't want users to store only a reference to a chosen file, not the
file itself. Is there a way to calculate what's in the container field.
And, while we're at it, the size of the referenced file?
--
http://clk.ch
FileMaker offers the "Insert Picture/QuickTime/File" script commands to
place data into a container field. However, these script steps are limited
in that they must explicitly identify the particular file to be imported.
(You cannot express a path using a calculated value.) You can coax the user
a little by selecting the store only a reference tick-box, but you can not
force them. (The box can be un-ticked in the dialog) but read on...
If you want to dynamically control the contents of a container field, you
can instead use either the "Set Field" script step, or auto-enter options.
Both will accept a calculated value as a parameter.
The calculation must result in a string representing the file path in the
same format used by the "Insert Picture/QuickTime/File" script commands.
(Just an in any calculation, literals must be enclosed in quotes.) Supported
formats for the pathname include the following:
file:directoryName/fileName
filemac:/volumeName/directoryName/fileName
filewin:/driveletter:/directoryName/fileName
filewin://computerName/shareName/directoryName/fileName
image:directoryName/fileName
imagemac:/volumeName/directoryName/fileName
imagewin:/driveletter:/directoryName/fileName
imagewin://computerName/shareName/directoryName/fileName
movie:directoryName/fileName
moviemac:/volumeName/directoryName/fileName
moviewin:/driveletter:/directoryName/fileName
moviewin://computerName/shareName/directoryName/fileName
For example:
Set Field [Personnel::idPhoto; "imagewin:/D:/Photos/" &
Personnel::employeeID & ".jpg"]
will set idPhoto to show "23456.jpg" from the D:/Photos directory, when
employeeID is 23456.
When a container field is set using this method, the files are always stored
"by reference" only. They are not copied into the FileMaker database file.
If the original file is moved or renamed, FileMaker will display "the file
cannot be found" in the container field. If the original file is modified,
the new contents will be shown when it is updated.
Calculations may also reference container fields. for example, if you import
a picture "rose.gif" into field, "myImage" then the calculation
checkPic (calculation, text result) = TestDB::myImage
will return:
- "rose.gif" if you imported the picture from disk and stored it within
FileMaker
- "?" if you placed it into the field via the clipboard
- "size: 630,240
image:../../My Documents/My Pictures/rose.gif
imagewin:/D:/My Documents/My Pictures/rose.gif" if you imported it from
disk and stored only a reference to the file.
Using both techniques together, you could handle a situation where a
directory of images had to be moved or converted to a different format,
without re-importing them. For example:
Substitute ( Catalog::ProductImage; "/images/"; "/archived/")
If all the images referenced in your file had been moved to the "archived"
directory.
And of course it can be checked wether a user has choosen reference. Forcing
to import as reference is not possible I think.
It is easy to get the size of an imported pic using the length function.
(returns size in bites). Getting the size of a referenced file is quite an
other matter. I think it is only possible with the use of a plug-in.
But others may be of more assistance.
Hou je goed / keep well,
Ursus
|
|
0
|
|
|
|
Reply
|
Ursus
|
1/7/2011 8:04:08 PM
|
|
<Ursus> wrote:
> checkPic (calculation, text result) = TestDB::myImage
>
> will return:
>
> - "rose.gif" if you imported the picture from disk and stored it within
> FileMaker
> - "?" if you placed it into the field via the clipboard
> - "size: 630,240
> image:../../My Documents/My Pictures/rose.gif
> imagewin:/D:/My Documents/My Pictures/rose.gif" if you imported it from
> disk and stored only a reference to the file.
What is the calculation of such a checkPic field? I know readastext to
extract the path and length to extract the file size.
> It is easy to get the size of an imported pic using the length function.
Thanks: I validate the container field with
length (self) = 0.
--
http://clk.ch
|
|
0
|
|
|
|
Reply
|
clk
|
1/8/2011 11:58:48 AM
|
|
On 8/01/11 2:46 AM, Christoph Kaufmann wrote:
> FMP 10 Adv:
>
> I don't want users to store only a reference to a chosen file, not the
> file itself. Is there a way to calculate what's in the container field.
> And, while we're at it, the size of the referenced file?
>
Hi Christoph
the example inserted as a reference
an additional field (or script variable)
aec_image_as_text = GetAsText( image)
If the image is inserted (i.e. not as a reference); then the aec
returns a single value; the file name
1_PhelinO-Orange_Chaos.jpg
If an image is inserted as a reference, the aec result is 3 values
(example result below is wrapped )
size:1440,900
image:../../../../../Pictures/iPhoto Library/Original
/2006/20%2F10%2F2006/1_PhelinO-Orange_Chaos.jpg
imagemac:/data/cortical/Pictures/iPhoto
Library/Originals/2006/20%2F10%2F2006/1_PhelinO-Orange_Chaos.jpg
I also add an object on the layout with a conditional format (fill
red, text white)to flag the user (i.e flag red if insert as reference
occurs:)
CF:
ValueCount ( Images_product_acrr::aec_text_image_details) > 1
text:
This image appears to have been inserted as a reference.
Please re-insert with reference un-checked
Chris
|
|
0
|
|
|
|
Reply
|
105
|
1/9/2011 2:11:54 AM
|
|
"Christoph Kaufmann" schreef in bericht
news:1jus101.145p3zvmfg8w6N%clk@tele2.ch...
<Ursus> wrote:
> checkPic (calculation, text result) = TestDB::myImage
>
> will return:
>
> - "rose.gif" if you imported the picture from disk and stored it within
> FileMaker
> - "?" if you placed it into the field via the clipboard
> - "size: 630,240
> image:../../My Documents/My Pictures/rose.gif
> imagewin:/D:/My Documents/My Pictures/rose.gif" if you imported it
> from
> disk and stored only a reference to the file.
What is the calculation of such a checkPic field? I know readastext to
extract the path and length to extract the file size.
> It is easy to get the size of an imported pic using the length function.
Thanks: I validate the container field with
length (self) = 0.
--
http://clk.ch
The calc was the old version (fmp 7), where you didn't need the getastext
Hou je goed / keep well,
Ursus
|
|
0
|
|
|
|
Reply
|
Ursus
|
1/9/2011 7:43:08 PM
|
|
|
4 Replies
855 Views
(page loaded in 0.129 seconds)
|