Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 8561 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi there,

I have tons of fields in tons of different databases that need scripted protection. As of now, I have sapatate script for each field, but the scripts are almost identical. However, because in each of my scripts I need to go to different field, I need sapareate script for each field.

Is there a way in FM to "bind" a button to the field, so that when it performs the script, it automatically is performed on the field that this button is on?

Thanks

Posted

Hello BikeBoy,

you have two ways to accomplish your job:

  • buttonize each field (layout mode & right-clicking on each field)

    (in this case you MUST click (not TAB) on each field to launch the script)

  • use a plug in that allows you to launch a script each time you exit from a field; i think this is the better way.

    If you are interested in, take a look to www.wmotion.com (the plugin is EVENTS, formerly ScriptScheduler)

Hope this helps.

Posted

When I come across similar needs, I create a script that will generically do the job and then create a separate script for each different job that sets a global field to a particular value. The the script that does the generic job acts based on the information in the global field.

For instance, I recently needed to have a script run whenever a user clicked on an item in a checkbox. There were fifteen different items available, so I had fifteen different scripts, all of which looked like this:

Set Field [ gChecked_Option, "Option1" ]

Perform Script [ Sub-scripts, Generic Operation ]

The Generic Operation script then did what it needed to do based on the value in gChecked_Option. This doesn't do away with the need to have fifteen separate scripts, but it does make the scripting easier. If I need to make a change in the Generic Operation, it will apply to all fifteen of the scripts with one change.

Chuck

Posted

Chuck,

This may be a silly question, but how are you triggering the set field action? My situation is similar. I have a field of radio buttons for a project status. Idle, Active, or Complete and when any of the buttons are selected I need a script to run. I understand your thinking, but I don't understand what is triggering the set field. Can you explain in more detail? Thanks. crazy.gif" border="0

Posted

Over each of the check boxes I've drawn a square that is the same size as the individual check boxes. Each of these is attached to a script. The script handles everything. Normally when you click a check box if the box was checked then the value next to it is taken out of the field. If the box was unchecked then the value next ot it is added to the field after a carriage return, if it isn't the only value. Since when you script things yourself, you have to account for these issues, I'll go ahead an include the entire script here. This will have some steps that won't be necessary for you, such as the steps which perform the tasks I needed for this particular script, but most of it is what you would want to handle.

The key to understanding why all of the PatternCount and Set Fields are necessary is this: When you define a field to be a checkbox and click multiple items, these items are all in the field separated by returns.

Here's one of the scripts that is run when the user selects the option "New DC"

code:


Set Field [ gTask, "New DC" ]

Perform Script [ Sub-scripts, " Add Task from Checkbox to Task Schedule" ]

BTW, there are two spaces in the name of that script in the Perform Script call. I sometimes place two spaces at the beginning of a script name if is it always a sub-script, as this one is.

Here's the " Add Task from Checkbox to Task Schedule" script. I'll point out which steps are specific to my solution:

code:


If [ PatternCount( Tasks, gTask ) ]

Posted

quote:

Originally posted by BobWeaver:

Filemaker needs to create a new status function:

Status(CurrentButtonName)

laugh.gif" border="0

Boy, wouldn't that be great?!? Then we wouldn't need to have all these scripts.

Chuck

This topic is 8561 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.