Someone please help…
I have a dialog box with 7 Fields
FieldValue0 = prompt for expense type (editable)
FieldValue1 = date (editable)
FieldValue2 = dblookup to Client Name (editable)
FieldValue3 = dblookup to Client Miles * employee miles (computed)
FieldValue4 = FieldValue3 * .40 (computed)
FieldValue5 = Reimbursement amount (editable)…I would like to default to FieldValue4, but find that it can’t be done
FieldValue6 = Description (editable)
What I’m trying to do is If FieldValue5 DOES NOT equal FieldValue4, the user MUST fill in a reason in the description field. I’m using an input validation formula:
@If(FieldValue0 = “SS Mileage” & FieldValue5 != FieldValue4 & FieldValue6 = “”; @Failure(“You must enter a description for this non-default mileage”); @Success)
It always fails even when the 2 fields match. I’m realizing it must have something to do with the comparing of a computed and editable field. Is there any way around this?? This is making me crazy.
Thanks!!
Subject: Field Validation - Again
Two things I reckon:
When comparing numbers (they are both number fields aren’t they?) you should use <> rather than !=, so change that to FieldValue5<>FieldValue6
Also, are you sure they’re exactly the same? The computed field could return a number with any number of decimals (even though you might be displaying 2). Maybe put some rounding in there also.
hth
Dan
Subject: RE: Field Validation - Again
Thank you very much…this works perfectly!
Subject: Field Validation - Again
Hi,
try this for debugging purposes:
@If(FieldValue0 = “SS Mileage” & FieldValue5 != FieldValue4 & FieldValue6 = “”;
@Failure(“You must enter a description for this non-default mileage. FieldValue0:” + @Text(FieldValue0) +
" FieldValue5: " + @Text(FieldValue5) + " FieldValue4: " + @Text(FieldValue4) + " FieldValue6: " & @Text(FieldValue6) );
@Success)
This will show you the different field values at validation time. I don’t know if they are all text values, that’s why I put @Text around the variables. If you are certain, that they are all text, you can omit @Text. If you omit @Text, you will also be able to see if there are any type mismatch problems.
Best regards
Mario Varchmin
http://www.e-llennium.com/e-llennium/index_en.htm
Subject: Field Validation - Again
When checking numbers, use @FloatEq instead of “=” . Binary-to-decimal conversion errors mean that there will almost always be a small error in floating point numbers, and unless the numbers you are checking were generated in EXACTLY the same way, they are not likely to be exactly equal.