I am doing a comparison between two fields on save…
Field CEF_Acct_Total = @If(CEF_Acct_Amt_1 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_1) +
@If(CEF_Acct_Amt_2 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_2) +
@If(CEF_Acct_Amt_3 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_3) +
@If(CEF_Acct_Amt_4 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_4) +
@If(CEF_Acct_Amt_5 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_5) +
@If(CEF_Acct_Amt_6 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_6) +
@If(CEF_Acct_Amt_7 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_7) +
@If(CEF_Acct_Amt_8 = “”; @TextToNumber(“0”); CEF_Acct_Amt_8) +
@If(CEF_Acct_Amt_9 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_9) +
@If(CEF_Acct_Amt_10 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_10) +
@If(CEF_Acct_Amt_11 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_11) +
@If(CEF_Acct_Amt_12 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_12) +
@If(CEF_Acct_Amt_13 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_13) +
@If(CEF_Acct_Amt_14 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_14) +
@If(CEF_Acct_Amt_15 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_15) +
@If(CEF_Acct_Amt_16 = “”; @TextToNumber(“0”) ; CEF_Acct_Amt_16)
(All CEF_Acct_Amt_… are numeric fields and convert to the value of zero if left blank.
Cef_CheckAmt is just an editable numeric field formated as currency w/ two decimal places.
Cef _Acct_Total is a computed numeric field formated as currency, also with two decimal places.
ReadyForSave is standard numeric field, that I was just using as a bypass in case the form doesn’t save. I set it to two if it doesn’t save.
I have a QuerySave entry formula that reads like this…
@If(CEF_Acct_Total != CEF_CheckAmt & ReadyForSave != 2 ;
@Do(@Prompt([Ok]; “Warning” ; “Check Amount Does Not Match Total for All Accts!” + @Text(@IsText(CEF_Acct_Total)) + @Text(@IsText(CEF_CheckAmt)));
@SetField(“ReadyForSave”; 0);@Return(“”));
@Do (@SetField(“ReadyForSave”; 1);@True))
Problem … the document saves properly when using standard integers. If the fields don’t match, then they get the text as noted in the formula. However, if any of the CE_Acct_Amt_“NN” fields are negative, my query save formula causes the @If statement to not match and gives me the warning statement.
In trouble shooting, I had the @Prompt formula to throw in both the “CEF_Acct_Total” and “CEF_CheckAmt” fields and it showed that they matched. Also, I had the same prompt show the @IsText results, and they both showed “0” stating that they were both numeric fields.
The ReadyForSave field has alwasy remained to.
Why is the @If formula failing?