IsleOfView
asked on
Simple If Formula Question
I have a form that has a set of fields, of type number, that need to be set to zero, if the user doesn't enter a number. I just wanted to write a formula on QuerySave to accomplish this. Here's what I did:
fldLocationIP1 = @If(fldLocationIP1 = ""; "0"; fldLocationIP1)
What might be wrong with this?
TIA!
fldLocationIP1 = @If(fldLocationIP1 = ""; "0"; fldLocationIP1)
What might be wrong with this?
TIA!
ASKER
When I put that into the QuerySave event, I get the following error (when attempting to save the formula):
No main or selection expression in formula "
Any ideas?
No main or selection expression in formula "
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for trying, but that didn't work either.
Here's what I finally got to work. I placed the following code in the InputValidation event for each field I needed checked:
FIELD fldLocationIP1:=fldLocatio nIP1;
@If(fldLocationIP = ""; @Failure(@SetField("fldLoc ationIP1"; 0)); @Success)
That seems to do the trick!
Here's what I finally got to work. I placed the following code in the InputValidation event for each field I needed checked:
FIELD fldLocationIP1:=fldLocatio
@If(fldLocationIP = ""; @Failure(@SetField("fldLoc
That seems to do the trick!
fldLocationIP1 := @If(fldLocationIP1 = ""; 0; fldLocationIP1)
You could also place this formula in the default value so that each field is automatically set to 0