dbTalk Databases Forums  

Container field validation

comp.databases.filemaker comp.databases.filemaker


Discuss Container field validation in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Christoph Kaufmann
 
Posts: n/a

Default Container field validation - 01-07-2011 , 10:16 AM






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

Reply With Quote
  #2  
Old   
 
Posts: n/a

Default Re: Container field validation - 01-07-2011 , 02:04 PM






"Christoph Kaufmann" schreef in bericht
news:1juqigi.13kcy841owaal8N%clk (AT) tele2 (DOT) 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

Reply With Quote
  #3  
Old   
Christoph Kaufmann
 
Posts: n/a

Default Re: Container field validation - 01-08-2011 , 05:58 AM



<Ursus> wrote:

Quote:
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.

Quote:
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

Reply With Quote
  #4  
Old   
105
 
Posts: n/a

Default Re: Container field validation - 01-08-2011 , 08:11 PM



On 8/01/11 2:46 AM, Christoph Kaufmann wrote:
Quote:
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

Reply With Quote
  #5  
Old   
 
Posts: n/a

Default Re: Container field validation - 01-09-2011 , 01:43 PM



"Christoph Kaufmann" schreef in bericht
news:1jus101.145p3zvmfg8w6N%clk (AT) tele2 (DOT) ch...

<Ursus> wrote:

Quote:
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.

Quote:
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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.