Jump to content

Calculation using If for two cases


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

Recommended Posts

Hi all

I am trying to get a calculation field called GST working to fuction like an if, elseif statement.

THere are two situations where this calulation needs to be done.

GST=

If Classes::type="Movement and Music" then cost*.07

or GST=

If Classes::type="birthday" then cost+14

Here is what I had for the first part.

GST=

If ( Classes::type="Movement and Music" ; cost*.07 )

THis works for the first instance.

When I add:

If ( Classes::type="birthday" ; cost+ 14 )

Filmaker complains that there is an operator missing.

I tried adding an or in between but that seemed to give a value of "1" when either case occurs.

Any Ideas about what I might be doing wrong?

Link to comment
Share on other sites

I prefer the Case, it is easier to read and to writht

Off of the top of my head, try:

Case (Type="Movement and Music"; cost*.07; Type="Birthday"; cost +14)

or maybe

Case (Type="Movement and Music"; cost*.07; Type="Birthday"; cost +14; cost)

In case you want a cost when it doesn't meet the critera.

HTH

Lee

Link to comment
Share on other sites

Lee

Thanks for your reply. What a wonderful thing this forum i!! The "Case" function works like a charm much better than the if statement.

Now my problem is the result of the calculation field needs to rounded to two decimal points.

Here is what I have

Case (Classes::type="Movement and Music" ; cost*.07; Classes::type="instrument"; cost*.07; Classes::type="birthday" ; cost*.07; Classes::type="CD"; cost*.07)

I figure it has something to do with the Round function but I can't figure out how to use it.

Thanks in advance.

Link to comment
Share on other sites

You got it:

Enclose the whole thing in the Round.

Round ( Case (Classes::type="Movement and Music" ; cost*.07; Classes::type="instrument"; cost*.07; Classes::type="birthday" ; cost*.07; Classes::type="CD"; cost*.07) ; 2)

HTH

Lee

Link to comment
Share on other sites

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