Jump to content

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

Recommended Posts

Posted

I would like to customize my calculations, in that, whatever I type into a text field, I would like that to be used as the calculation in another field

Example,

I have four fields: A_1 , A_2, B_1, C_1

I would like to enter the equation 'sum(A_1, A_2)' (or any valid FMP equation) into the C_1 field, and have the B_1 field display the result of that equation.

cheers

kevin

Posted

Actually I was not looking for a calculator.

Here's another explanation.

I would like to enter the formula 'sum(A_1, A_2)' or some other valid FMP expression such as 'GetField(A1)' into a field (text or not) and have another field perform that operation. So, instead of entering 'sum(A_1, A_2)' into the field "B_1" directly, I would like to type it into a field named "C_1" and have the "B_1" field display the result of that formula. This would give me the flexibility to change my calculation at will.

I hope I was much clearer this time.

thanks

kevin

Basically,

Posted

I've done a simple 4-function calculator on two fields and it turned out to be very complex, because each variation has to be hard-coded into the system. More functions and more variables will increase the cmplexity geometrically.

Summary: yes it can be done, but it's gonna be a huge undertaking. Start by working out how many variables you want to work with, and the number of functions you want to support. The fewer of each the better.

For example, the calc I made went something like this:




Case [operator = "+", A + B,

      operator = "-", A - B,

      operator = "*", A * B,

      operator = "/", A / B]







Increasing the function to fit three variables is significantly more work, since there are now 16 diferent permutations of functions to calculate to support the four functions... it'll be n*n for n functions.







Case [operator1 = "+" and operator2 = "+", A + B + C,

      operator1 = "+" and operator2 = "-", A + B - C,

      operator1 = "-" and operator2 = "+", A - B + C,

      operator1 = "-" and operator2 = "+", A - B - C,

      ... yada yada yada...]



This topic is 7977 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.