Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation Formula 1

Status
Not open for further replies.

medmax

Technical User
Apr 18, 2003
3
IL
Hi,

I'm trying to learn how to use FM Pro, in MAc OSX, from the "FM P 6 Getting Started" tutorial. But I think there is something missing in "Calculation Field" Lesson.

When I write this formula
If (Membership Type = "Continuing", 100, 200)

I got the message;
An operator is expected here: 200

What is wrong in this formula?

Thanks in advance.

Mamede
Aveiro University, Portugal

 
I have to assume there is a field named membership type. The only thing I can see that you may have done wrong is typed the field name incorrectly. The format of the calculation looks perfect.

If you are new to calculations in FM, get to know the Case( ) function. It's faster and easier to format than If( ).

Your example could look like this:

Case(Membership Type = "Continuing", 100,
Membership Type = "Non-Continuing", 200,
Membership Type = "Regular", 300,
Membership Type = "Preferred", 400)

I hope this helps.

Marty
 
Marty, thanks for the help, but...

I'm trying the Case function and I still get the error message. This time, the dialog box said "An operator is expected here" (then selected the word "Type" in the formula)

Just for checking, I made a test with the FM tutorial original files. I opened a file that has a calculation field with the logical function "if" already written. Then, in the Specify Calculation dialog box, I clicked "ok" without changing anything. For my surprise, the error message appeared!!!

If the formula is right and there isn't any digitation error, do you think the problem could be in the software or in the OS?

thanks again,
Mamede
 
If you select the if or case function from the FM Calculation menu and click OK you will get this error message everytime. This is how the if statement originates when you first select it.

If ( test , result one , result two )

Clicking OK and having this work would require 'test' to be a field in your database, plus some kind of test like = "yes", then if test = yes, result one would be true. Result one and result two would have to be in "" to actually get rid of any error message. Like so:


If ( test = "yes", "result one", "result two")

To clarify the possible problem you are having is not typing the 'If' or the syntex correctly, it's likely the field you are referencing does not exist or is spelledc incorrectly based on my experience.

Using the above example, "Membership Type" should be a field existing in your database. Any misspelling of the field name will give you this error.

I have a test.fp5 file I can email you if you'd like. Send me an email and I'll email you a solution or email me your file and I'll look at it for you.

mlisonbee@charter,net

I hope this helps.

Marty
 
Problem solved!

Including the formula's results in "" (parenthesis), like you said, if or case function works fine.

I apreciated your help, thanks!

Mamede

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top