I’m trying to use @SetField to change the value of one field to that of another after performing an operation and I’m getting the error:
“Incorrect data type for operator or @Function: Number expected”
Both the field I want to change and the field where the data is coming from are editable text fields so I’m not understanding the error. Here’s the code I’m using:
@If(@IsDocBeingSaved&(KitCheck!=KitNumbers);(("Kit Numbers Changed from “+KitCheck+” to “+KitNumbers+” by “+@Name([CN];@UserName)+” on “+@Text(@Today)+” at "+@Text(@Now; “S1”)):KitNumHistory)&@SetField(“KitCheck”;KitNumbers);KitNumHistory)
Any help would be greatly appreciated!
Subject: @SetField problem
It’s the “&” that expects a number, and the string you built before the “&” is apparently not a number. (By the way, @Do is the “proper” way to perform multiple commands, “&” is an old work-around that relied on the success return from a function to trick the formula languge engine into doing something it wasn’t originally designed to do.) I believe that you probably intended to @Prompt the string or assign it to a variable or field.
Subject: RE: @SetField problem
Thanks for the reply, I took the “&” out and I’m not getting the error anymore, but now it’s printing the value of the @SetField variable rather than appending the text/field string that comes before it to the “KitNumHistory”:
(("Kit Numbers Changed from “+KitCheck+” to “+KitNumbers+” by “+@Name([CN];@UserName)+” on “+@Text(@Today)+” at "+@Text(@Now; “S1”)):KitNumHistory)
Here’s the new code:
@If(@IsDocBeingSaved&(KitCheck!=KitNumbers);@Do((“Kit Numbers Changed from “+KitCheck+” to “+KitNumbers+” by “+@Name([CN];@UserName)+” on “+@Text(@Today)+” at “+@Text(@Now; “S1”)):KitNumHistory;@SetField(“KitCheck”;KitNumbers));””);
Subject: RE: @SetField problem
What were you expecting to happen? All you are doing in that statement is this:
("Kit Numbers Changed from “+KitCheck+” to “+KitNumbers+” by “+@Name([CN];@UserName)+” on “+@Text(@Today)+” at "+@Text(@Now; “S1”)):KitNumHistory
You haven’t told Notes what to do with the string. Should it be assigned to a variable? Should it be put into a field? Should it be prompted?
Subject: RE: @SetField problem
That string is what I want the field to display, but instead of displaying, for example:
Kit Numbers Changed from 1111 to 1113 by John Smith on 6/21/2005 at 10:23 AM
It just displays 1113.