I thought I recalled seeing a list of functions that could be used in the calculation field (other than the basic four: +, -, /, x), but I can’t seem to find it now. Here’s a short observation on more interesting calculations.
I found that the following functions seem to work great:
SIN(fieldname) where fieldname is a Numeric field.
COS(fieldname)
TAN(fieldname)
LOG(fieldname) [although couldn’t figure out natural log]
SQRT(fieldname) for square root
PI may be used in calculations as PI
If you are using SIN(), COS(), TAN(), be aware that fieldname must be in radians (or be converted from degrees to radians in the calculation by multiplying degrees by PI/180).
The default for calculation fields seems to be zero decimal places–remember to assign the desired number of decimal values.
The calculation field offers more than I originally thought. Very nifty–if you need that sort of thing.
I didn’t publish these extra math functions because I wanted to have a better math parser than what I have now. Plus you can’t enter that stuff on the iOS version. But they should work fine nonetheless.
Good sleuthing though!
Thanks!
Brendan
One more: Raising to powers in the TF OSX calculation field.(TF 2.2.3)
[fieldname]^3 in the calculation field will give you the cube of fieldname.
If you have two separate numeric fields, the following works too:
[fieldname1]^[fieldname2] returns fieldname1 raised to the power of fieldname2
If you want to see the original source of the math library I’m using, you can find it here:
http://apptree.net/parser.htm
But I’m hoping to change to this parser at some point:
Math Parser for Objective C
It has some interesting features. I’m also hoping to modify the parser to support string concatenation. So you could do “Total: ” + Cost * 1.05 + ” owed”. Or even simply First Name + ” ” + Last Name.
Thanks!
Brendan