8 Replies Latest reply on Jun 1, 2015 4:51 PM by montshoman

# Auto-Enter Multiplication Product Question

### Title

Auto-Enter Multiplication Product Question

### Post

I'm new to fm, and am trying to create a field that is the product of simple multiplication in another field, basically something along the lines of 3x5 in the first field, and 15 automatically populating into the next field.

I attempted to go under management, change the field to "calculation" (right now it's "text"), and when it brings up the next window typed =PRODUCT and double-clicked the field where the 3x5 is entered, when I click ok it kicks up a warning about needing " (which I've added and it still gives me the same warning)?

One more variable I ned to mention is the 3x5 field is occasionally text only instead of numbers, will this create more problems than I'm trying to solve?

Thank you in advance for any assistance

• ###### 1. Re: Auto-Enter Multiplication Product Question

As a starting point, check out the Evaluate function. It will take text and evaluate the result, which seems like what you want.

Evaluate ( "3*5" ) = 15.

- m

• ###### 2. Re: Auto-Enter Multiplication Product Question

Note that you use * instead of X as the multiplication operator.

You can also set up two fields instead of 1 and a calculation field with this expression:

Field1 * Field2

to compute the product of fields 1 and 2.

• ###### 3. Re: Auto-Enter Multiplication Product Question

I appreciate your responses, please have patience with me,

Mork Afur - how do you set up your response with varying number combinations, I didn't explain myself very well, 3x5 was an example, it may be 8x4, 2x2, or any variance of combinations not exceeding 8x20, and not smaller than 1x1.5, but these numbers are always in the "size" field, and I was hoping to auto-enter the total in the next field "total size"?

PhilModJunk - I may have to result to dividing this information into 2 fields, I was trying to keep it in one field as occasionally this field is text instead of always being a widthxlength?

• ###### 4. Re: Auto-Enter Multiplication Product Question

Mixing text and numbers in a field when the numbers have to be treated as numbers is generally not a good idea. You may even want three fields, the third for cases where you enter just text.

But to use evaluate, you might use this expression:

Evaluate ( Substitute ( YourTable::YourTextField ; "x" ; "*" ) )

You enter this expression into YourTextField and a different field with the above expression will compute and display the area.

If you set this up as an auto-enter calculation, be sure to clear the "do not replace existing value" check box.

• ###### 5. Re: Auto-Enter Multiplication Product Question

Like Phil suggested I would use two fields.

I created a sample database called "deleteme" (so I remember to ... delete it).

I created two fields, field1 and field2.

Now, it doesn't matter what numbers are in them.

You can use Evaluate (Field1 * Field2) in a calculated field, or whatever.  Evaluate figures out what's in the text and still is able to ... evaluate it. You may not need Evaluate all that often, but it's an incredibly powerful function. Other languages have similar capabilities.

See screenshot below showing the data viewer.

- m

• ###### 6. Re: Auto-Enter Multiplication Product Question

In the above example, deleteme::field1 * deleteme::field2 will produce an identical answer as "Evaluate" is unnecessary for that expression. It basically tells FileMaker to do what it was going to do already.

• ###### 7. Re: Auto-Enter Multiplication Product Question

Well, OK, I was generalizing from a single field's "3*5" expression itself which does require an Evaluate for FMP to figure out.

It's neat that FMP does a behind-the-scenes data conversion on two text fields.

- m

• ###### 8. Re: Auto-Enter Multiplication Product Question

Thank you Thank you!  Working without conflicts, that's so AWESOME!!