5 Replies Latest reply on Dec 20, 2015 4:16 PM by argus2

# Case function confusion

Hi,

I've been trying to get the Case function to solve a problem whereas the If function falls short. The syntax, based on the default...

Case ( test1 ; result1 {; test2 ; result2 ; ... ; defaultResult} ) has me a little stumped. If I substitute my information into this function I get an error.

Case ( TOTAL Number of Errors QC1 ≥ 0 ; 1 {; TOTAL Number of Errors QC2 ≥ 0 ; 2; TOTAL Number of Errors QC3 ≥ 0; 3} )

The error highlights the first brace ({) bracket only and says, "The specified field cannot be found."

All I wanted was to have the Quality Check field, i.e. "QC number" give a return of 1, 2 or 3, based on the content of three other fields.

• ###### 1. Re: Case function confusion

Though the calc doesn't make sense in other ways, if you drop the curly braces at least it will work.

But almost always numbered fields ( xxxQC1, xxxQC2, xxxQC3) indicate a design problem.

What is the purpose of this calc and what do the numbered fields represent?

Case (

TOTAL Number of Errors QC1 ≥ 0 ; 1 ;

TOTAL Number of Errors QC2 ≥ 0 ; 2;

TOTAL Number of Errors QC3 ≥ 0; 3

)

• ###### 2. Re: Case function confusion

you might be happy with max(TOTAL Number of Errors QC1; TOTAL Number of Errors QC2; TOTAL Number of Errors QC3)

or with

TOTAL Number of Errors QC1> 0 +

(TOTAL Number of Errors QC2 > 0 ) * 10 +

(TOTAL Number of Errors QC3 > 0 ) * 100

then playing with the result, which will be self-explaining of what the input was.

but your choice of field names is frightening me.

• ###### 3. Re: Case function confusion

Thanks Bruce, your mention of a design problem has me rethinking what I've done so far. Here is the actual file:

This is a checklist, separated into 4 tabs. Each tab indicates a subsequent revision to a file. Each time a file is received, it goes through the "P" (pass) "F" (Fail) of each item down the list, with the number of errors totalled at the bottom. What I had hoped to do was, each time a Quality Check is done (QC1, 2, 3 and 4), it would be reflected in the QC Number field at the top. The Case function was to test the total number of errors in each QC Tab and if it was 0 or greater, place an integer in the QC number. Was hoping to automate the QC number field. Currently it's a manual dropdown of 1,2,3 and 4.

Hope this explanation makes sense.

• ###### 4. Re: Case function confusion

How do you store the Pass/Fail info ?

n fields ?

repeating field ?

portal ?

• ###### 5. Re: Case function confusion

Hi siplus, (got a chuckle from your comment on my field names!!)

Without having a great knowledge of Filemaker, I did this in two steps.

1. Into a hidden field, I performed If statements that convert the fails ("F") into an integer...

here's one for example...

If ( Barcodes QC1="F" ; 1 ; 0 )

Then, in the "errors field" ( the red 3 in my attachment), I totalled the results.

I'm assuming from your response and Bruce's, there are much better ways to accomplish this task. I think I'm headed for a few more tutorials!!!