October 1, 201015 yr 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
October 1, 201015 yr If there is only one value in the Type field, you could use simply: Case ( Type ≠ "Receipt" and Type ≠ "Mileage" ; … )
October 1, 201015 yr 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 October 1, 201015 yr by Guest
October 1, 201015 yr 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 October 1, 201015 yr by Guest
October 1, 201015 yr 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.
October 1, 201015 yr 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...
October 1, 201015 yr 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 October 1, 201015 yr by Guest
October 1, 201015 yr 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 October 1, 201015 yr by Guest Grammar
Create an account or sign in to comment