Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 183: | Line 183: | ||
If the standard tools can not be set to the desired value of the field by default, it can be done through a script. | If the standard tools can not be set to the desired value of the field by default, it can be done through a script. | ||
===== | ===== Previous value of another field ===== | ||
There is a library containing the records of the daily running of the car, bicycle or your walks. The library has StartingMileage field and Mileage.When you create a record is required in the field StartMileage enter data from the field Mileage previous record. | |||
<source lang="javascript" line> | <source lang="javascript" line> | ||
var entries = lib().entries(); | var entries = lib().entries(); | ||
Line 192: | Line 193: | ||
} | } | ||
</source> | </source> | ||
# | |||
# | # Get the current library the lib () and a list of entries it records (). | ||
# | # Check that the list is not empty entries, otherwise stop the script, so we do not have a previous record. | ||
# | # Records list is sorted from newest to oldest, respectively, the previous record is at the beginning of the list with an index value of 0. Get the Mileage field from the previous record. | ||
# We set the value of the field Mileage from the previous record as the default value for the field StartMileage. | |||
=====Начало следующего дня===== | =====Начало следующего дня===== |