Triggers: Difference between revisions

381 bytes removed ,  19 September 2016
m
no edit summary
mNo edit summary
mNo edit summary
Line 199: Line 199:
# We set the value of the field Mileage from the previous record as the default value for the field StartMileage.
# We set the value of the field Mileage from the previous record as the default value for the field StartMileage.


=====Начало следующего дня=====
===== Beginning the next day =====
Если требуется в поле дата/время при создании записи устанавливать начало следующего дня, то это может сделать следующий скрипт.
If you want the date/time field when creating a record, set the beginning of the next day, it can make the following script. For the script, you must connect the JavaScript-library moment.js [http://momentjs.com/ moment.js]
Для скрипта необходимо подключить JavaScript-библиотеку [http://momentjs.com/ moment.js]
 
<source lang="javascript" line>
<source lang="javascript" line>
var m = moment().add(1,'d')
var m = moment().add(1,'d')
Line 207: Line 207:
entryDefault().set("Date" , m.toDate().getTime())
entryDefault().set("Date" , m.toDate().getTime())
</source>
</source>
#С помощью функции moment() библиотеки '''moment.js''' получаем текущее время и прибавляем 1 день.
 
#Устанавливаем время 8 часов и 0 минут.
# With the moment () function library moment.js obtain the current time and add 1 day.
#Записываем значение по умолчанию для поля Date.
# Set time of 8 hours and 0 minutes.
Скрипт должен быть установлен для действия ''Создание записи'' и фазы ''Открытие формы''.
# Write a default value for the field Date.
 
The script must be set for action Creating a record and phase Opening a form.


==Работа с файлами==
==Работа с файлами==