dbTalk Databases Forums  

Scripting file paths for container fields

comp.databases.filemaker comp.databases.filemaker


Discuss Scripting file paths for container fields in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
ursus.kirk
 
Posts: n/a

Default Re: Scripting file paths for container fields - 11-07-2005 , 08:48 AM






In the filemaker help it is clearly stated that the new script variables
can't be used for path statements.

Search on using variables, then clicking on the same title produces a page
with basic variable explanation. Scroll down and it says:

Notes
Variables are only supported in script steps that use stored file paths.
Variables are not supported in file paths that are stored in container
fields.
Variables are not supported in file references.

Ursus

"Michael Paine" <mpaine (AT) tpgi (DOT) com.au> schreef in bericht
news:436e8487$0$16565$afc38c87 (AT) news (DOT) optusnet.com.au...
Quote:
I have tried the suggested method and other variations (with and without
the "/" before pic) without success. I have even tried using a dialog box
to check that the $$pic string is correct before the Go to Field step.

I can combine path and field value in the Insert Picture (as suggested by
Ursus) but just using a global variable $$pic does not seem to work. Also
mixing $$pic with a field value gives an error message in Scriptmaker.

Since I can obtain the desired output with IF ELSE statements I will go
that way for now. Thanks for the suggestions but I dont have time to
experiment more.

Michael Paine




Michael Paine wrote:
Thanks Howard. I will try it again. Maybe the Help text is out of date?
Michael Paine

Howard Schlossberg wrote:

Michael Paine wrote:

The script below did not work as I expected (one problem may be that
the global variable $$pic is not recognised within the insert picture
statement (it automatically puts quotes around it). When I checked Help
it came up with the limitation I mentioned before

Enter Browse Mode
Go to Layout [ “fancy_test” (Vehicles) ]
Set Variable [ $$pic; Value:"imageics/" & Vehicles::head_drv_colour ]
Go to Field [ Vehicles::head_drv_pic ]
Insert Picture [ “$$pic” ]
[ Reference ]



I just tried the equivalent of this and it worked:
Set Variable [ $$pic; Value:"image:/pics/" & Vehicles::head_drv_colour ]
Go to Field [ Vehicles::head_drv_pic ]
Insert Picture [ “$$pic” ]

Note the extra slash after image:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance



Reply With Quote
  #12  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: Scripting file paths for container fields - 11-07-2005 , 11:46 AM






Perhaps I'm not understanding what is being attempted. If you are
trying to store a variable name as part of a field value or calc value
and then have the image appear by reference from the text calc, then no,
I wouldn't expect it to work because you are trying to use what is in
essence a dead variable.

But if you are running a script that includes the Insert Picture step,
and you are inserting a text string that was originally defined, in
whole or in part, by a variable -- but you are now inserting the value
of that variable...then it should work fine and that is what I tested with.

So in my tests, the following was performed with success:

1) In a table called 'Table', create a text field and a container field.

2) Create a script:
Set Variable [ $$pic; Value:"image:/c:/Tests/" & Table::TextField ]
Go to Field [ Table::Container ]
Insert Picture [ “$$pic” ]

This last step has been tested both with and without the 'store only a
reference' option.

3) Create a new record.

4) Enter "cute dog.jpg" into a text field (where "cute dog.jpg" is the
name of an actual file inside the c:/Tests/ folder)

5) SUCCESS: Run the script and the cute dog appears in the container field.

6) I then created two new fields: TextField2 and ContainerCalc, where
the ContainerCalc field is =TextField2, unstored with container result.

7) In my script I add a step at the beginning:
Set Field [ Table::TextField2; $$pic ]

8) Run the script and now I have my cute dog appear in both the
Container and the ContainerCalc fields.

What am I doing that you are not doing to make this work?



ursus.kirk wrote:
Quote:
In the filemaker help it is clearly stated that the new script variables
can't be used for path statements.

Search on using variables, then clicking on the same title produces a page
with basic variable explanation. Scroll down and it says:

Notes
Variables are only supported in script steps that use stored file paths.
Variables are not supported in file paths that are stored in container
fields.
Variables are not supported in file references.

Ursus

"Michael Paine" <mpaine (AT) tpgi (DOT) com.au> schreef in bericht
news:436e8487$0$16565$afc38c87 (AT) news (DOT) optusnet.com.au...
I have tried the suggested method and other variations (with and without
the "/" before pic) without success. I have even tried using a dialog box
to check that the $$pic string is correct before the Go to Field step.

I can combine path and field value in the Insert Picture (as suggested by
Ursus) but just using a global variable $$pic does not seem to work. Also
mixing $$pic with a field value gives an error message in Scriptmaker.

Since I can obtain the desired output with IF ELSE statements I will go
that way for now. Thanks for the suggestions but I dont have time to
experiment more.

Michael Paine




Michael Paine wrote:
Thanks Howard. I will try it again. Maybe the Help text is out of date?
Michael Paine

Howard Schlossberg wrote:

Michael Paine wrote:

The script below did not work as I expected (one problem may be that
the global variable $$pic is not recognised within the insert picture
statement (it automatically puts quotes around it). When I checked Help
it came up with the limitation I mentioned before

Enter Browse Mode
Go to Layout [ “fancy_test” (Vehicles) ]
Set Variable [ $$pic; Value:"imageics/" & Vehicles::head_drv_colour ]
Go to Field [ Vehicles::head_drv_pic ]
Insert Picture [ “$$pic” ]
[ Reference ]


I just tried the equivalent of this and it worked:
Set Variable [ $$pic; Value:"image:/pics/" & Vehicles::head_drv_colour ]
Go to Field [ Vehicles::head_drv_pic ]
Insert Picture [ “$$pic” ]

Note the extra slash after image:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #13  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: Scripting file paths for container fields - 11-07-2005 , 11:49 AM



ursus.kirk wrote:
Quote:
In the filemaker help it is clearly stated that the new script variables
can't be used for path statements.

Search on using variables, then clicking on the same title produces a page
with basic variable explanation. Scroll down and it says:

Notes
Variables are only supported in script steps that use stored file paths.
Variables are not supported in file paths that are stored in container
fields.
Variables are not supported in file references.
Note that in my last example, I did not break any of these rules. You
can use variables in script steps to your heart's content, as anything
set via a script results in a stored file path.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #14  
Old   
Michael Paine
 
Posts: n/a

Default Re: Scripting file paths for container fields - 11-13-2005 , 02:50 PM



Using my new Filemaker database I now have the capability to produce
reasonable quality pictures of the "coloured men" that appear on the
Euro NCAP car crash test website. The pictures are a collage of elements
that are chosen under program control and depend on a dozen or so injury
ratings from the database.
See http://idisk.mac.com/mpaineau-Public...ED_DUMMIES.gif
for a sample.
Thanks again for the tips
Michael Paine


Michael Paine wrote:

Quote:
I have tried the suggested method and other variations (with and without
the "/" before pic) without success. I have even tried using a dialog
box to check that the $$pic string is correct before the Go to Field step.

I can combine path and field value in the Insert Picture (as suggested
by Ursus) but just using a global variable $$pic does not seem to work.
Also mixing $$pic with a field value gives an error message in Scriptmaker.

Since I can obtain the desired output with IF ELSE statements I will go
that way for now. Thanks for the suggestions but I dont have time to
experiment more.

Michael Paine




Michael Paine wrote:

Thanks Howard. I will try it again. Maybe the Help text is out of date?
Michael Paine

Howard Schlossberg wrote:

Michael Paine wrote:

The script below did not work as I expected (one problem may be that
the global variable $$pic is not recognised within the insert
picture statement (it automatically puts quotes around it). When I
checked Help it came up with the limitation I mentioned before

Enter Browse Mode
Go to Layout [ “fancy_test” (Vehicles) ]
Set Variable [ $$pic; Value:"imageics/" & Vehicles::head_drv_colour ]
Go to Field [ Vehicles::head_drv_pic ]
Insert Picture [ “$$pic” ]
[ Reference ]




I just tried the equivalent of this and it worked:
Set Variable [ $$pic; Value:"image:/pics/" & Vehicles::head_drv_colour ]
Go to Field [ Vehicles::head_drv_pic ]
Insert Picture [ “$$pic” ]

Note the extra slash after image:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance

Reply With Quote
  #15  
Old   
JC
 
Posts: n/a

Default Re: Scripting file paths for container fields - 11-14-2005 , 02:24 PM



Howard:

I was looking at the info in this link. I am workinig on something
similar. However, the "variables" is all new to me. I tried to
emulate what you did above. I'm not sure I understand what a variable
is. Is it a global field?? When I tried your example above it kept
telling me "table not found" in fron of the $$pic.

Could you explain a little more to someone new to this.

Thanks so much
jc


Reply With Quote
  #16  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: Scripting file paths for container fields - 11-14-2005 , 03:03 PM



Local variables ($VariableName) and global variables ($$VariableName)
are a feature that is new to FileMaker 8. As in other program
languages, variables are used to store values in memory (rather than the
longtime FileMaker method of creating a separate global field to hold
each value.

You can set variables by either using the 'Set Variable As' script step,
or you can set it via any calc (i.e field definition, Set Field step,
within a button's script parameter, etc) by using the Let() function.



JC wrote:
Quote:
Howard:

I was looking at the info in this link. I am workinig on something
similar. However, the "variables" is all new to me. I tried to
emulate what you did above. I'm not sure I understand what a variable
is. Is it a global field?? When I tried your example above it kept
telling me "table not found" in fron of the $$pic.

Could you explain a little more to someone new to this.

Thanks so much
jc

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #17  
Old   
JC
 
Posts: n/a

Default Re: Scripting file paths for container fields - 11-14-2005 , 03:25 PM



Thank you Howard:

I was trying to do that with FM7 Although I have FM8 as well.

thanks
JC


Reply With Quote
  #18  
Old   
JC
 
Posts: n/a

Default Re: Scripting file paths for container fields - 11-14-2005 , 04:21 PM



Howard:

That worked like a charm. How could make it store the "reference"
instead of the whole pic?

Thanks
JC


Reply With Quote
  #19  
Old   
JC
 
Posts: n/a

Default Re: Scripting file paths for container fields - 11-14-2005 , 04:44 PM



Howard:

Found the reference right after I asked the question. but; is there a
way to build a script that will email out that same picture file using
filemaker?

Thanks
jc


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.