# Calculation field - Case function or IF?

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

## Recommended Posts

Hello Gurus!

I am bit stuck with attempting to use the calcualtion field along with Case function so some help would be really apprechiated

scenario:

c_PaymentNeed can be: 1 or -1 or 0 (zero)

I would like to reflect this output with text.

I have created another calculation field that uses Case statement as:

```c_PaiedInfo = Case(c_PaymentNeeded,0,"INVOICE PAIED IN FULL",c_PaymentNeeded, "> 0","PENDING - NOT PAIED",c_PaymentNeeded, "< 0","OVERCHARGED")

```

The logic is:

IF

'c_PaymentNeeded' is 'zero' THEN output "PAIED IN FULL"

ELSE

'c_PaymentNeeded' is 'positive number' THEN output "NOT PAIED in FULL"

ELSE

'c_PaymentNeeded' is 'negative number' THEN output "WE OverCharged You"

ENDIF

Should I be looking into direction of "IF" statements or can a Case handle it?

Many thanx for the feedaback!

FileMaker Version: 6

Platform: Windows 2000

##### Share on other sites

You could use a Case or

Choose( cPaymentNeeded + 1, "WE Overcharged You", "PAID IN FULL", "NOT PAID IN FULL" )

since cPaymentNeeded + 1 will equal 0, 1, or 2.

##### Share on other sites

Hi Queue!

Thanx for post...but I am still having trubles...your sample works only if the result is "zero" and would not work if the actuall cPaymentNeeded is =1

cPaymentNeeded can be:

-\$250.00 ............WE overcharged You

\$1.00 ..............Not paied in Full

\$0.00 ..............Paied in Full

I know we are talking only 1 dollar diff. but ont 1,000 of records....

what went wrong in that Case statement I used above?....is the synthax correct?

Thanx!!!

##### Share on other sites

Oh, my bad. I thought you meant the field could be -1, 0, or 1. You meant positive or negative.

Case( c_PaymentNeeded = 0, "INVOICE PAID IN FULL", c_PaymentNeeded > 0, "PENDING - NOT PAID", c_PaymentNeeded < 0, "OVERCHARGED" )

##### Share on other sites

Oh great!

Thank you very much!

I knew I was close in logic...it was the synthax that "got me"

Excellent!

##### Share on other sites

By the way, you can use the Choose function above, just add Sign( ) around cPaymentNeeded.

very nice!

##### Share on other sites

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

## Create an account

Register a new account