Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 139: | Line 139: | ||
===== findByKey(name) ===== | ===== findByKey(name) ===== | ||
: Search | : Search all entries by the Entry Name. The library must be set for unique Entry Names. | ||
:; Argument: '''name''' — the Entry Name field value | :; Argument: '''name''' — the Entry Name field value | ||
:; Result: Entry object | :; Result: Entry object | ||
Line 150: | Line 150: | ||
==== Properties ==== | ==== Properties ==== | ||
: '''Title''' — The name of the library | : '''Title''' — The name of the library | ||
=== Object ''Entry'' === | === Object ''Entry'' === | ||
This object holds an entry of the current library, | This object holds an entry of the current library, allowing the setting of field values | ||
==== Entry Methods ==== | ==== Entry Methods ==== | ||
===== set(name, value) ===== | ===== set(name, value) ===== | ||
: Set the value of the named field. | : Set the value of the named field. Calling this method results in immediate writing of the value to the library. | ||
:; Arguments | :; Arguments | ||
Line 166: | Line 165: | ||
: Get the value of the named field | : Get the value of the named field | ||
:; Argument: '''name''' — name of the field | :; Argument: '''name''' — name of the field | ||
:; Result: The value of the field | :; Result: The value of the field. The type of the result depends on the type of the field. | ||
==== Entry Properties ==== | ==== Entry Properties ==== | ||
: '''Title''' — | : '''Title''' — entry name | ||
: '''Description''' — description | : '''Description''' — entry description | ||
: '''Favorites''' — true, if the entry is in Favorites | : '''Favorites''' — true, if the entry is in Favorites | ||
: '''Deleted''' — true, if the record is deleted (it is in the | : '''Deleted''' — true, if the record is deleted (it is in the Recycle Bin) | ||
=== Object DefaultEntry === | === Object DefaultEntry === | ||
Template with default values for a new | Template with default values for a new entry | ||
==== Methods ==== | ==== Methods ==== | ||
Line 188: | Line 187: | ||
==== Data Validation ==== | ==== Data Validation ==== | ||
Using scripts, you can check the correctness of input data. For example, | Using scripts, you can check the correctness of input data. For example, perhaps a field integer values are allowed only from 0 to 200. | ||
<source lang="javascript" line> | <source lang="javascript" line> | ||
var num = entry().field("Number") | var num = entry().field("Number") // Get the value of field Number | ||
if (num < 0 || num > 200) { | if (num < 0 || num > 200) { // Test for value matching allowable range | ||
message("Wrong range"); | message("Wrong range"); // If the value is outside the range, display message "Wrong range" | ||
cancel(); | cancel(); // Cancel the operation | ||
} | } | ||
</source> | </source> | ||
This script should be used for the Event '''Create entry''' or '''Update entry''' in the Before Saving phase. | |||
This script should be used for the | |||
==== Set default values ==== | ==== Set default values ==== |