9 Replies Latest reply on Sep 2, 2012 3:54 PM by Sorbsbuster

# Calculation help

### Title

Calculation help

### Post

Can someone tell me what this calculation should look like? I am looking for a calculation for field "y".

Field "x" is the same as field "y" unless field "a" is equal to or greater than field "b". And then, if field "a" is equal to or greater than field "b" we will subtract 1 from field "y". This will be the end result to field "y."

In other words, if you input a number in Field "x" - field "y" will display the same number - unless - a number entered in field "a" is equal to or greater than a number entered in field "b". So field "y" will end up being 1 less than field "x" when "a" is equal to or greater than "b".

Is this as clear as mud? Hopefully, I've explained what I'm after.

• ###### 1. Re: Calculation help

the calculation for field y would be:

If(a ≥ b;x-1;x)

• ###### 2. Re: Calculation help

Okay. Part of this works. The part that you gave me works, but if a is not equal to or greater than b, then the resulting number in x is displayed as a question mark.

If a is not equal to or greater than b, then I need x to be the same as y.

x will be equal to y - unless a is equal to or greater than b...

Hope this clarifies.

• ###### 3. Re: Calculation help

The calculation works as stated in your first question.  You changed information in  your  comment.  Which is correct?

As in question

I have four fields :  x,y,a,b

y is a calculation field and x,a,b are all number fields

x=y unless a is = or > than b then will be 1 less than x.

thats what the formal will do.

the if statement is for y and says if a >= b; x-1 else it is x.

you need to besure your calculation return number.

here is sample app that computes as stated in question.

https://www.sugarsync.com/pf/D9559058_790_706996864

• ###### 4. Re: Calculation help

Yours works exactly the way it is supposed to. I'm not sure why I can't get mine to work the same way. I see that it's really simple, but I'm missing something. Thank you for the time you put in to answering this and making the sample db. I really appreciate it! I'll keep looking at mine and comparing with yours until I get it right.

• ###### 5. Re: Calculation help

I would be sure that the y cacluation is set to return a number and that all your other fields are numbers.

• ###### 6. Re: Calculation help

...and that the field size on the layout is wide enough to display the answer.  Otherwise you get '?'.

• ###### 7. Re: Calculation help

I checked to make sure the layout was wide enough and that's not the problem. I think it has something to do with the way the records are stored. Your fields don't say anything about being stored, or indexed. Mine say "Unstored" then the If statement.

• ###### 8. Re: Calculation help

I finally figured it out. Mine works now exactly the way it's supposed to.
Thanks!

• ###### 9. Re: Calculation help

And, for future generation sof Filemaker Developers, the trick was...?