Add a new value to your tracker (see
how to create a tracker?) |
|
|
|
This function will only use values from the current entry, so set the Previous: endpoint to <none>. Set the Current: endpoint to distance so this result will only be calculated when there is a value in the distance field. In this case, the function will also not be calculated without a value in the time field as this is recognized as a division by zero.
|
|
|
|
|
|
Here's a second function has been defined to use the results of the first.
|
|
The finished Exercise tracker in use. |
A function is calculated over all of the entries (green spots) between the previous and current endpoints inclusive. In the figure, the brown spots are entries which fall outside of the red function range, so they are not included in the calculation. The current endpoint will always correspond to a timestamped entry, while the previous endpoint may not match a specific entry.
Previous: | Current: endpoint selected | Meaning |
entry |
The function will be calculated using data from the previous entry
and/or the current entry. |
Values (user specified) |
For the current
endpoint, the function won't be calculated until the specified value
has data entered. For the previous endpoint, the function will start with the last entry with data entered in the specified value. In the Car tracker, the mileage function is only calculated between two entries with 'tank full' yes/no values checked. This way the calculation is still correct if you occasionally add small amounts fuel without filling up. |
Time differences Hours, Days, Weeks, Months, Years |
The previous
endpoint will be the specified number of time units before the current
endpoint (only available for previous
endpoint setting). If the current entry is 12 December with a time difference of '-2 months', the previous endpoint will be the same time on 12 October. |
Calendar unit time differences Cal Days, Cal Weeks, Cal Months, Cal Years Option: Only last |
The previous endpoint
will be counted back only by complete
time units before the current
endpoint (only available for previous
endpoint setting). If the current entry is 12 December with a time difference of '-2 cal months', the previous endpoint will be 12:00 a.m. on 1 November. The 'Only last' option controls the graph presentation for functions with calendar endpoints. This is used in the Drinks tracker for the 'daily alcohol' and 'daily caffeine' values. The graph will normally display one data point for each entry, so without this option there would be a 'ramp' shown shown for each day if you had one, two and then a third cup of coffee. Enabling the 'Only last' option will suppress the display of the first and second entries in the graph, so for that date it would only show a point at '3'. |
<none> | The function is only calculated using data in the current entry
(only available for previous
endpoint setting). See the 'Speed' |
Please note: It is entirely possible to create a function which does not make mathematical sense, creates an infinite loop, or has some other logical problem. rTracker will allow you to create and save such a function, but will crash when it is executed by attempting to use the tracker. If you create or find a tracker that crashes when used, please inspect its functions and try to think through how they will work in practice.
Single Value Operators | Result |
change_in | The value in the first entry is subtracted from the value in the last entry. Example: change_in[odometer] in the Car tracker. |
sum, post-sum, pre-sum | The value is summed up over all entries in the range. post-sum skips the first entry in the summation, used in the Car tracker as post-sum[fuel] for the mileage calculation (the mileage can only be calculated from when the tank is full, but should not include the fuel to fill it on that first entry). pre-sum skips the last entry in the range to match post-sum; let me know if you find a use for it! |
avg | The value is summed up over the entries in the range. If the previous endpoint is a time unit (e.g. -2 weeks), the sum is divided by the number of time units (2 in the example); otherwise the sum is divided by the number of entries in the range. |
min, max | The minimum or maximum value over the entries in the range is returned. |
count | The number of entries in the range where the value has data stored. |
old/new, new/old | The ratio of the value between the first and last entries in the range is returned. |
elapsed_<time_units> |
The 'Time Counters' below can only report the time difference
between the function range endpoints. The
elapsed_<time>[value] will calculate the number of time units
for the 'value' entries over the range. For example, if your
function is "change_in[electricity_meter]/days" and your range is
"-10 days to current entry", the result will always be (last_reading
- first_reading)/10. To get the actual electricity used per
day, use
"change_in[electricity_meter]/elapsed_days[electricity_meter]"; this
will calculate the elapsed days between the first and last reading
for the denominator. |
Two Value Operators | Result |
+ - * / () | As expected |
Time Counters | Result |
weeks, days, hours, minutes, seconds | Returns the number of time units specified between the first and last entries in the range |
Other | Result |
constant | Allows specifying a fixed value in a formula without storing in the database (compare to the info value) |