dbTalk Databases Forums  

Set Field doesn't accept parameters

comp.databases.filemaker comp.databases.filemaker


Discuss Set Field doesn't accept parameters in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Al Hatch
 
Posts: n/a

Default Set Field doesn't accept parameters - 08-23-2005 , 01:17 AM






This is a problem with passing a parameter to a script to tell it which
layout to use.

I have created a script that opens a Layout and Sets a field in that layout.
Simple.
Now imagine a Layout with a half-dozen buttons. Each button runs this same
script, but the Layout it goes to is different for each button.

I could make 6 copies of the script, modifying each one to change the name of
its destination layout.

But Iıd prefer to write the script once, then have each button pass a
parameter with the name of its destination layout.

The Script step ³Go to Layout² accepts a parameter to tell it which layout to
go to.
The Script step ³Set Field² does not.
So, using parameter passing, I can get to the proper layout, but, once Iım
there, I canıt set a field on that layout.

Any ideas?


Reply With Quote
  #2  
Old   
Shadenfroh
 
Posts: n/a

Default Re: Set Field doesn't accept parameters - 08-23-2005 , 05:47 AM






Convince Filemaker to add the feature? ;-)

I agree that this would be a great enhancement. Similarly, it would be nice
to perform a script identified by a parameter (i.e. perform script,
"process_" & case ( left (cc ; 1 ) = 4 ; "visa" ; left (cc ; 1 ) = 5 ; "mc"
.....)

The best I've come up with as a workaround isn't very graceful, but...

If you can put the field on the layout, and in the tab order, you can loop
through the fields using the Go To Next Field step, and then use Get (
ActiveFieldName ) to determine when you've reached the appropriate field.
Then use the insert instead of set field.

Like I said, not graceful, but...

--

Chris Cain
Extensitech, Inc.
ccain (AT) extensitech (DOT) com


"Al Hatch" <Hatch@-REMOVETHIS-waywewill.com> wrote

Quote:
This is a problem with passing a parameter to a script to tell it which
layout to use.

I have created a script that opens a Layout and Sets a field in that
layout.
Simple.
Now imagine a Layout with a half-dozen buttons. Each button runs this same
script, but the Layout it goes to is different for each button.

I could make 6 copies of the script, modifying each one to change the name
of
its destination layout.

But Iıd prefer to write the script once, then have each button pass a
parameter with the name of its destination layout.

The Script step ³Go to Layout² accepts a parameter to tell it which layout
to
go to.
The Script step ³Set Field² does not.
So, using parameter passing, I can get to the proper layout, but, once Iım
there, I canıt set a field on that layout.

Any ideas?




Reply With Quote
  #3  
Old   
audleman@quasika.net
 
Posts: n/a

Default Re: Set Field doesn't accept parameters - 08-23-2005 , 12:59 PM



Pass a generic parameter to your script to identify the field (e.g.
'1', '2', '3'), then have a case statement that calls SetField[]. e.g.

Case "1";
SetField[Layout1::foo; "data"];
Case "2";
SetField[Layout2::bar; "data"] ;

It's not as clean as passing in the variable name, but at least you're
down to all changes taking place in one script.

Kevin


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

Default Re: Set Field doesn't accept parameters - 08-23-2005 , 01:02 PM



I agree that it would be nice to be able to set fields and run scripts
based on a calculated result. But we already have script parameters in
7, so you can use one script to be run from six different buttons. Pass
the parameter from the button to the script, and then use
get(scriptparameter) in the script to branch off to different layouts,
subscripts or Set Fields using If/ElseIf statements. Not very difficult.


Shadenfroh wrote:
Quote:
Convince Filemaker to add the feature? ;-)

I agree that this would be a great enhancement. Similarly, it would be nice
to perform a script identified by a parameter (i.e. perform script,
"process_" & case ( left (cc ; 1 ) = 4 ; "visa" ; left (cc ; 1 ) = 5 ; "mc"
....)

The best I've come up with as a workaround isn't very graceful, but...

If you can put the field on the layout, and in the tab order, you can loop
through the fields using the Go To Next Field step, and then use Get (
ActiveFieldName ) to determine when you've reached the appropriate field.
Then use the insert instead of set field.

Like I said, not graceful, but...

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

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #5  
Old   
Al Hatch
 
Posts: n/a

Default Re: Set Field doesn't accept parameters - 08-23-2005 , 07:01 PM



Chris, your suggestion works. You're right, it's a kluge, but...

And, by the way, Set Field does not work at all. It cannot be controlled by a
parameter, whether in an If loop, or subscript or calculation. Set Field just
doesn't work with passed parameters.

On Tue, 23 Aug 2005 11:02:18 -0700, Howard Schlossberg wrote
(in article <11gmp5djr949o2c (AT) corp (DOT) supernews.com>):

Quote:
I agree that it would be nice to be able to set fields and run scripts
based on a calculated result. But we already have script parameters in
7, so you can use one script to be run from six different buttons. Pass
the parameter from the button to the script, and then use
get(scriptparameter) in the script to branch off to different layouts,
subscripts or Set Fields using If/ElseIf statements. Not very difficult.


Shadenfroh wrote:
The best I've come up with as a workaround isn't very graceful, but...

If you can put the field on the layout, and in the tab order, you can loop
through the fields using the Go To Next Field step, and then use Get (
ActiveFieldName ) to determine when you've reached the appropriate field.
Then use the insert instead of set field.





Reply With Quote
  #6  
Old   
42
 
Posts: n/a

Default Re: Set Field doesn't accept parameters - 08-23-2005 , 09:19 PM



In article <0001HW.BF3106E8000CDBC7F03B65B0 (AT) news-radius (DOT) core.com>,
Hatch@-REMOVETHIS-waywewill.com says...
Quote:
Chris, your suggestion works. You're right, it's a kluge, but...

And, by the way, Set Field does not work at all. It cannot be controlled by a
parameter, whether in an If loop, or subscript or calculation. Set Field just
doesn't work with passed parameters.
That's why he suggested using insert instead of set field with the loop.


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.