![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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? |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
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... |
#5
| |||
| |||
|
|
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. |
#6
| |||
| |||
|
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |