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!
IsleOfViewAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
wrichardConnect With a Mentor Commented:
On the last line of the formula put
select @all
0
 
wrichardCommented:
Try these simple changes...
fldLocationIP1 := @If(fldLocationIP1 = ""; 0; fldLocationIP1)

You could also place this formula in the default value so that each field is automatically set to 0
0
 
IsleOfViewAuthor Commented:
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?
0
 
IsleOfViewAuthor Commented:
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:=fldLocationIP1;
@If(fldLocationIP = ""; @Failure(@SetField("fldLocationIP1"; 0)); @Success)

That seems to do the trick!
0
All Courses

From novice to tech pro — start learning today.