Scripting in the Memento application
Native Memento Calculation scripting
The specifications for scripting for the Calculation field type is described in Calculation field.
- The field() function gets the value of the field from Memento.
- Anything after "//" is ignored, so you can use it for comments.
- For numbers, x * y means the numerical product of x times y.
- x = y means for Memento to assign to x the value of y.
- For numbers, x + y means the sum of x and y, while if x & y are strings of text, it means x concatenated with y.
- Item price // on an invoice
- field("Unit price") * field("Quantity")
- Amount for display // Final sum
- field("Total") + " widgets"
- Limited // The capped amount
- value = field("Value"); if (value <= StandardLimit) value else StandardLimit
See http://momentjs.com and its subordinate pages Guides and Docs.
- To get the current date, use moment().toDate(). To get the current date & time, use moment().toDate().getTime().