Jump to content

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

Recommended Posts

Posted

Hi,

This seems to be such a simple little problem, but I just CANT get it to work. I think the problem may be of my understanding of AND and OR's in Filemaker.

I've done very similar to this before, but never with multiple conditions.

I have a grade level field that is one of two, High or Low. If the person is High, the comment_whole can be of the length 'High length'. If the person is low, the length can be 'Low length'. This are different numbers, as it depends how they're printed. If the comment_whole field is longer then the appropriate length, I want it to show up with some sort of text showing the user, at the moment "error" will do.

This is what I would assume would work:

If(((Length(comment_whole) > length of low) and (students::grade level = "Low")) or ((Length(comment_whole) > length of high) and (students::grade level = "High"))), "error", "no error")

When that didn't work I tried many things. I can't even get this version to work.

If(((Length(comment_whole) > length of low) and (students::middle senior = "Low")), "error", "no error")

It doesn't seem to do both, and shows up with error if the comment_whole is longer then the length of low, even if the student is "High". If I change the 'and' to an '&', it works *better* but still not as I would expect it.

Any suggestions would be greatly appreciated. I've been working on this one silly little IF statement all day!

Thanks

Jo

Posted

Hi Jo,

It is a bit difficult to tell from your post because I am not sure of your relationships and what the difference between

students::grade level = "Low"

students::middle senior = "Low"

is, but try reformatting the calc as a nested case statement:

Case(students::grade level = "Low",

case(Length(comment_whole) > length of low, "error", "no error"),

students::grade level = "High",

case(Length(comment_whole) > length of high, "error", "no error"))

if that doesnt work, try:

Case(Length(comment_whole) = length of low, "working ok", "low field is not defined as a number, change "low" field to a number")

grin.gif

type the number 1 in the field "low" and a single letter in the comment_whole field to check that this much is working.

-Raz

Posted

Hi,

Sorry for that confusion!

students::grade level and students::middle senior are the same field.

The last thing you suggested works perfectly. Extending on it, this is what I now have working perfectly.

Case(Length(comment_whole) > length of low, "error", "working ok")

In part, even this works:

Case(Length(comment_whole) > length of low, "low error",

Length(comment_whole) > length of high, "high error", "working ok")

The problem is getting in the AND. That gives a high error if the comment is longer then length of high, even if the student is low level.

It has to be if the comment length is longer then length of high AND they're in low level.

Any more ideas?

Posted

I have figured it out and thought I'd post it in case anyone else can learn from it smile.gif

It had to be a messy nested IF, which required a bit of tweaking. The relationship back to the student file also mucked it up. I created a field with a lookup value of that same field. Here is the code:

If(

grade level = "High",

If(

Length(comment_whole) > length of high, "High Error!", "Is high, but no error!"),

If(

grade level = "Low",

If(

Length(comment_whole) > length of low, "Low Error!", "Is low, but no error!"),

"ERROR cause not high nor low"))

And it now works!!!

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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