Triggers: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 219: Line 219:
</source>
</source>


# Get the current library &mdash; lib() &mdash; and a list of entries.
# Get the current library and an array of its entries.
# Check that the list is not empty of entries; otherwise stop the script, so we do not have a previous entry.
# Check that the array is not empty of entries; otherwise stop the script, so we do not have a previous entry.
# Entries 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 entry.
# The array of entries is sorted from newest to oldest. The previous entry is set to the newest entry at the beginning of the array with an index value of 0. Get the Mileage field from the previous entry.
# We set the value of the field Mileage from the previous entry as the default value for the field StartMileage.
# We set the value of the field Mileage from the previous entry as the default value for the field StartMileage.