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

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

Recommended Posts

Posted

Hello everyone,

Here is my question: I have two number field, Number1 = 2 and Number2 = 3, and a text field Formula. Is it possible to enter, for example, the text "Number1 + Number2" in the field Formula and to make it react like a calculated field to have the result (5 in this case). In other words, is there a way to change the value of a text field to a calculation?

Posted

Hi christian,

If I'm understanding your question, the answer is yes. In fact there isn't a lot you can't do in FileMaker (might be hard to figure out how to put it together sometimes) but FileMaker can do just about anything a calculatior can do (I'm now ducking to keeping from getting hit head by an onslot of other taking their shots.) tongue.gif

Anyway, if this is what you asked

Field ,,,,,,,,,,,,,,Data

Number1............2

Number2............3

Field 3................5

Field 3 is a calculation and it would be like this:

Number1 + Number2

Result = number.

HTH

Lee

cool.gif

Posted

I'm not sure if you are wanting a simple calculation, but if so try this.

Field One (a number field) Field Two ( another number field) Field Three a calculation field defined and Field One + Field Two

Change the entry in either Field One or Field Two and the result shows in Field Three.

Posted

I'm not sure you've got exactly what I'm looking for...

FieldName | Type | Value

--------------------------------------------

1- 'Formula' | Text | "Number1 + Number2"

2- 'Number1' | Number | 2

3- 'Number2' | Number | 3

And what I want is that FileMaker recognise the text value of 'Formula' as a calculation, and gives me the result...You know what I mean? I think it's more dream than reality but if you see some solutions please let me know!

Posted

Hi Christian

Are both of your fields numbers or text or a combination (one is a number and one is a text)?

If they are both text, the calculation below (put into a third field, such as the Field3 of my post) will convert the text to numbers:

TextToNum(Number1) + TextToNum(Number2)

Just copy it and paste it in.

If only one is text, remove theTextToNum on the number field and use only the field name instead.

I have a small sample file showing how I did this, If you want a copy of it, let me know what operating system you are on.

HTH

Lee smile.gif

Posted

Ok, I will try to explain myself an other way...

Is it possible to have a text field that contains the formula of a calculation field? And better than this, change the formula of the calculation field by changing it on the text field?

Posted

The answer is a limited yes. It's limited because you (the programmer) are going to have to check for each mathematical operator and value individually. The more maths operators and values you allow the more complex the calculation becomes.

Let me give you an example: I made a file that takes two values and either adds, subtracts, multiplies or divides them. Unlike your question, the first value, operator and second value are in separate fields (Operator, Value1, Value2). The calculation to do this is:

Case(   PatternCount(Operator, "+") > 0,

                             TextToNum(Value1) + TextToNum(Value2),

        PatternCount(Operator, "-") > 0,

                             TextToNum(Value1) - TextToNum(Value2),

        PatternCount(Operator, "*") > 0,

                             TextToNum(Value1) * TextToNum(Value2),

        PatternCount(Operator, "/") > 0,

                             TextToNum(Value1) / TextToNum(Value2))

Notice the complexity for just 4 operators and two values: it'll do up geometrically as more operators and values are added!

That's why I say "limited yes." It can be done but it'll be very complex particularly of you want to include fancy functions.

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