Triggers: Difference between revisions

110 bytes added ,  6 October 2016
m
no edit summary
mNo edit summary
mNo edit summary
Line 210: Line 210:
                                                     // since there is no previous entry.
                                                     // since there is no previous entry.
prevMileage = entries[0].field("Mileage");          // The array is sorted from newest to oldest,
prevMileage = entries[0].field("Mileage");          // The array is sorted from newest to oldest,
                                                     // so the newest entry already in the array will be on top with index of 0.
                                                     // so the newest entry already in the array
entryDefault().set("StartMileage" , prevMileage )  // Set the value of the field Mileage from the previous entry as the default value for the field StartMileage.
                                                    // will be on top with index of 0.
entryDefault().set("StartMileage" , prevMileage )  // Set the value of the field Mileage from the previous entry
                                                    // as the default value for the field StartMileage.
}  
}  
</source>
</source>