
1. Re: Validated by calculation with If statement?
SteveMartino Jun 1, 2015 3:31 PM (in response to vtdonn)Is Field 2 set as a number field? Also, what does 'x' stand for? A number (number field) or word (text field)
In your calc, you may have a typo as the first field just says field.
What's should be the value if the statement is false?
First I would see if you need the quotes in "110". I don't think you do.
If (field1=x and field2 < 110; 0 if true; something here if false)
You can also do this with a case statement.

2. Re: Validated by calculation with If statement?
philmodjunk Jun 1, 2015 9:27 PM (in response to vtdonn)Note that, because of the quotes, "5" > "110" is a true statement while 5 > 110 is not a true statement.

3. Re: Validated by calculation with If statement?
vtdonn Jun 2, 2015 5:57 AM (in response to vtdonn)Thanks all. I'm sorting through a few moving parts in regards to field formatting and also leading zeros, so I'll have to do some experimenting. But so far, this is what I am working with for the calculation, with syntax and typos corrected
If ( field1 ≠ "1  merch" and field2 < 110; 0)
field1 is a text field, field2 is a number field.I am trying to say that if field1 does not equal "1  merch" and field2 is less than 110, then the entry must be 0. That is the validation that I am looking for. Am I barking up the wrong tree?Right now, the message "... is defined to contain only specific values. Allow this value?" appears no matter what I enter. So even when I use the calculation above, that message pops up when I enter "0" as a value.

4. Re: Validated by calculation with If statement?
philmodjunk Jun 2, 2015 6:23 AM (in response to vtdonn)A validation calculation must be a Boolean calculation. That's a calculation that evaluates to a result of True or False. With a number result values of 0 or Null will be False and all other number results will be True. Your expression always evaluates as either 0 or Null and thus always produces a False result (validation fails) and you get the validation error message.
As Steve has pointed out, you haven't indicated what values are permitted if your field 1 value either equals the quoted text or field 2 is greater than 110. I will assume that all values are permitted in that case:
If ( field1 ≠ "1  merch" and field2 < 110; Self = 0 ; self )