Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 204: | Line 204: | ||
Suppose there is a library containing daily mileage of daily walks or use of a car or bicycle. Suppose the library has a StartingMileage field and a Mileage field. When an entry is created, the field StartMileage must get data from the field Mileage in the previous entry. | Suppose there is a library containing daily mileage of daily walks or use of a car or bicycle. Suppose the library has a StartingMileage field and a Mileage field. When an entry is created, the field StartMileage must get data from the field Mileage in the previous entry. | ||
: | :<small>'''Trigger script:'''</small> | ||
<source lang="javascript"> | <source lang="javascript"> | ||
var entries = lib().entries(); // Get current library & array of its entries | var entries = lib().entries(); // Get current library & array of its entries | ||
Line 225: | Line 225: | ||
Suppose you need to identify the beginning of a new day in the DateTime field. (The script requires connection of the JavaScript library '''moment.js''' [http://momentjs.com/ moment.js].) | Suppose you need to identify the beginning of a new day in the DateTime field. (The script requires connection of the JavaScript library '''moment.js''' [http://momentjs.com/ moment.js].) | ||
: | :<small>'''Trigger script:'''</small> | ||
<source lang="javascript"> | <source lang="javascript"> | ||
var m = moment().add(1,'d'); // Using the moment.js library function moment(), | var m = moment().add(1,'d'); // Using the moment.js library function moment(), | ||
Line 242: | Line 242: | ||
:; Note — Add new trigger: Add a new trigger to the Applications library. Set Event '''Creating a new entry''', Phase '''Before saving the entry'''. (A similar script could be set for Event '''Updating an entry''' Phase '''Before saving the entry''', but only if a change in a field value is to trigger the add of the new member.) | :; Note — Add new trigger: Add a new trigger to the Applications library. Set Event '''Creating a new entry''', Phase '''Before saving the entry'''. (A similar script could be set for Event '''Updating an entry''' Phase '''Before saving the entry''', but only if a change in a field value is to trigger the add of the new member.) | ||
: | :<small>'''Trigger script:'''</small> | ||
<source lang="javascript"> | <source lang="javascript"> | ||
// Get the application entry that's being saved and call it e | // Get the application entry that's being saved and call it e |