Jump 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.

Calculation field - Case function or IF?

Featured Replies

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

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.

  • Author

Hi Queue!

Thanx for post...but I am still having trubles...your sample works only if the result is "zero" frown.gif 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!!!

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

Try changing your Case to

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

  • Author

Oh great!

Thank you very much!

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

Excellent!

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

  • Author

very nice!

Create an account or sign in to comment

Important Information

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

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.