Write, Bureaucrats, Administrators
4,332
edits
(Created page with "{{Stamp|2016-10-23|4.0.0|1.0.5}} Upon occasion, one might want to access a "previous" entry to determine the value of a field in the current entry. For example, a stock trade...") |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Stamp| | {{Stamp|2018-10-02|4.5.0|1.1.0}} | ||
Upon occasion, one might want to access a "previous" entry to determine the value of a field in the current entry. For example, a stock trade might reference the immediately preceding trade of that stock to get the price of the trade as the current value of the stock during the next trade. | Upon occasion, one might want to access a "previous" entry to determine the value of a field in the current entry. For example, a stock trade might reference the immediately preceding trade of that stock to get the price of the trade as the current value of the stock during the next trade. | ||
Line 31: | Line 31: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
function | var order = { compare: function(a,b) { return a.field("Mileage") - b.field("Mileage"); }} | ||
entries.sort(order); | entries.sort(order); | ||
</source> | </source> | ||
Line 40: | Line 40: | ||
The primary place where this code can be used is when creating a new entry. Using the Triggers facility available in mobile editions starting with release 4.0.0 (http://wiki.mementodatabase.com/index.php/Triggers), the trigger script must be set for Event '''Creating an entry''' Phase '''Open the Entry Edit card'''. It will run synchronously. | The primary place where this code can be used is when creating a new entry. Using the Triggers facility available in mobile editions starting with release 4.0.0 (http://wiki.mementodatabase.com/index.php/Triggers), the trigger script must be set for Event '''Creating an entry''' Phase '''Open the Entry Edit card'''. It will run synchronously. | ||
[[Category:How]] |