Jump to content
Salesforce and other SMB Solutions are coming soon. ×

a script to select a calculation depending on the radio button selected


MS3
 Share

Recommended Posts

Hi

I'm fairly new to Filemaker and really green when it comes to scripting but I want to add a script to my database that will perform 1 of 3 calculations depending on what radio button is selected, if this is possible

Field Name is "Colony Count to Use" and the radio button options are "Colony Count 1", "Colony Count 2" and "Both".

The calculations are a little complex but I should be able enter them in without too many problems as long as I know where they should go in the script. Finally I'd like the answer to populate "CFU per mL" field when the script is run. (As an aside should this field just be a number instead of a calculation?)

If you need more details or if my explanation is unclear please let me know

Thanks for you help!

Link to comment
Share on other sites

Make one global field ---> YourTable::CalcSelect ; select "Radio Button" in Inspector as the field type with a Value List =

 

Colony Count 1

Colony Count 2

Both

 

 

Make four scripts (the first three will be your respective complex calculations depending upon user choice):

 

Calculation1 (for Colony Count 1)

Calculation2 (for Colony Count 2)

Calculation3 (for Both Colonies)

 

 

Calculation Select (this is the 4th script)

If (YourTable::CalcSelect = "Colony Count 1"

...Perform Script (Calculation1)

End If

If (YourTable::CalcSelect = "Colony Count 2"

...Perform Script (Calculation2)

End If

If (YourTable::CalcSelect = "Both"

...Perform Script (Calculation3)

End If

 

 

The final step is to set an "OnObjectModify" Script Trigger on the global field (YourTable::CalcSelec) that selects the script "Calculation Select"

 

 

Make sure that the table that the global field resides in has at least one record.

Link to comment
Share on other sites

thanks for your help! It took me a little bit to get it going (too many interruptions on Friday) but it's working great now.

I just have to figure out the onobjectmodify. I want to make sure it modifies if I change the calcselect but also if the colony counts change right now it only lets me enter 1 digit before it starts running the script

 

I've played around with this problem all day and can't seem to figure it out...Help please...

How to get you get your script to run after you enter the data in the field?

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use