Cannot subtract text from a number but it is a number

I’m getting the following error in a procedure:

“cannot subtract text from a number”

Here is the procedure:

insertfield “RMD not taken”

fieldtype “float”

formulafill «RMD Current Year»-“YTD RMD Distributions”

Obviously, the procedure should make the field type into “float” (not “text”). The field After a few seconds, the error message in red

changes to green and says OK.

I recently installed Pan 10.2. I think this procedure ran OK in Panorama 10.1 (but I could be mistaken).

On another subject, is there a difference between quotes and chevrons?

Help please. Thanks

The error message is saying that “YTD RMD Distributions” is text, which it is. The quotes you put around it make that a literal string of text. By coincidence it happens to be the name of a number field in your database, but to Panorama, it’s just 21 characters of text. Change your formulafill to

formulafill «RMD Current Year»-«YTD RMD Distributions»

and it should work.

Yes, they are completely different.

Yes, that in fact was the issue. Chevrons are put around the name of a field or variable to indicate that everything within them, including spaces, dashes, slashes, and anything that might be interpreted as something else, are all part of the field or variable name. It’s the content of that field or variable that will actually be used in the formula.

Quotes are used to show that everything within them is just text, regardless if some of the characters look like operators, delimiters, or whatever.

It starts to get confusing when a command or function wants the name of a field, rather than it’s value, because it’s supposed to return information about the field, like its datatype, or how much memory its content is using, or you are telling it which field to search in a lookup, etc. In that case, you quote the name, so that the function will receive that name, and not its value.

Great explanation of the reason why field names sometimes have to be quoted.