Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Dynamic calculated field...is it just a dream?!?

Featured Replies

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?

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

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.

  • Author

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!

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

  • Author

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?

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.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.