November 12, 200520 yr Is there any way to pass a field name as a parameter, to use it on a Go to field step? I have 10 different buttons and 10 fields. When the user press each button, a script is run passing the optional parameter. A different parameter is passed with each button. This parameter is a field name. Then, I would like to use this parameter in the script to go to the corresponding field: button1 > field1, button2 > field2, etc. It would save me a lot of scripting because I can use one script for all the buttons. If I can further enhance it and pass the vfield name, then only a couple lines should suffice for many different fields. I was thinking in something like: Go to field ( Get (ScriptParameter)) but I cannot find a way to script it. Thanks
November 12, 200520 yr Hi, bluearrow take a look at this topic ! I think that it will be good for you ! :)
November 13, 200520 yr bluearrow, it's a complex subject but need not be; at least (I believe) for the type of functionality you require. Here's a sample of two views: First is using script parameter to specify the field the cursor should go to (passes field name). I use (the powerful) Exit Loop If[ ] because it has the ability to FIND a field easily even though not directly specified. It is of course, part of what's being discussed in the thread Daniele referenced but I thought an example might be of benefit. Parameters on the buttons and concatenated test within an Exit loop If[] controls where the cursor STOPS; which is (in reality) not much different than specifying which field to go TO. The wave technique in the file is a cheap, lazy example of producing effects to draw the eye of the User. I have yet to succeed running it through repetitions tho - it always stops at the second rep. But sometimes I'll use it for a quick flash to draw attention somewhere on the screen without having to result to pulsing paused scripts, etc. I make it look better than this of course. I just wanted you see some flexible options using a method that sounds complex or convoluted. It works quite well when the needs are simpler. LaRetta TheWave.zip
November 13, 200520 yr Author Thank you both for yuor replies. I read the topic and reviewed the sample file. The first example in this file was exactly what I needed. I tested it and it is working fine, going to the field stated in the parameter. I am a little bit reluctant to use looping scripts though, but I will try to find a way to control what happens if something goes wrong (for instance, if the field name is changed, but not the parameter passed to the script...) I wish FileMaker would add in the next version the posibility to pass the parameter directly in the Go to field step, or in Set Field. Thanks again.
November 13, 200520 yr Hi LaRetta do you remember our Loop/Exit Loop discussion ? Your file is a good example were is better to place the exitLoop quickly after Loop ! :)
Create an account or sign in to comment