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.

Case (PatternCount) Calculation, need help!!

Featured Replies

I don't know if I'm having a major brain fart today, but I can't figure this out.

What I have:

Case( PatternCount( Type; "Receipt") = 0; Expense)

What I need is if the Type = "Receipt" OR "Mileage" to return 0 (False).... but I can't seem to figure it out

Can someone point me in the right direction?

-Thanks

-VX

If there is only one value in the Type field, you could use simply:

Case ( Type ≠ "Receipt" and Type ≠ "Mileage" ; … )

Case( PatternCount( Type; "Receipt") = 0; Expense)

What I need is if the Type = "Receipt" OR "Mileage" to return 0 (False)

To add an additional criterion into what you are already doing, add some more conditions into your Case() leaving Expense as the default when no conditions are matched.

Case(

PatternCount( Type; "Receipt")>0; 0;

PatternCount( Type; "Mileage")>0; 0;

Expense

)

Since zero is considered false by FileMaker calcs you can shorten this to

Case(

PatternCount( Type; "Receipt"); 0;

PatternCount( Type; "Mileage"); 0;

Expense

)

If you find additional words in the future that also need a zero result, you can simply add extra conditions in the same format to the Case().

As Comment states above, if you are sure that Type is restricted to the exact values "Receipt", "Mileage", etc., you can remove the PatternCount() function.

Case(

Type="Receipt"; 0;

Type="Mileage"; 0;

Expense

)

Edited by Guest

  • Author

Wow, I didn't even think to use a reversed statement. I'll have to keep that in mind for future calculations. Thanks, I appreciate it.

Tom, thanks for that as well. The rules of this database change from time to time so adding additional "Types" might occur. Adding another condition is easy enough, I was just having HUGE brain fart. I'm on a low carb diet and I feel kinda hazy.

Edited by Guest

I guess what you want is:

case ( not PatternCount( Type; "Receipt") or not PatternCount( Type; "Mileage") ; "Expense" )

This shorter form also works, since zero is interpreted as boolean false, and any other (positive) value as true.

Hope this helps.

  • Author

I guess what you want is:

case ( not PatternCount( Type; "Receipt") or not PatternCount( Type; "Mileage") ; "Expense" )

This shorter form also works, since zero is interpreted as boolean false, and any other (positive) value as true.

Hope this helps.

That's what I was attempting to use but I wasn't working. I'm not sure what was going on...

Case( PatternCount("Receipt Mileage"; type ) = 0; Expense)

If you have many values to check, you can switch to something like:

IsEmpty ( FilterValues ( Type ; "Receipt¶Mileage¶Another" ) )

---

P.S. Beware of PatternCount() in these situations; it can easily return a "wrong" result when one value contains another, e.g. "Receipt" and "Not a Receipt".

Edited by Guest

  • Author

Ya, That's why I changed it to your initial suggestion where you dropped the Pattern Count.

Furthermore I decided to make the field contain a drop down list and is validated by that value list. So the field values are limited, but you make a good point.

Edited by Guest
Grammar

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.