Internal $D Methods
Basic functions
$D.eval() or $D.getValueFromTemplate() Getting the field value of the current object
$D.getValueFromTemplate = function(fieldName[string])
// the same but shorter:
$D.eval = function(fieldName[string])
// examples
var name = $D.getValueFromTemplate("{{name}}") // name == Ivan
// you also can get values from linked objects
var phone = $D.getValueFromTemplate("{{author_id.phone}}") // phone == 79141230000
// tip: for getting data from arrayLinks use $D.store.get()$D.store.get() Getting an object from a different structure
$D.store.get = function(structName[string], objectID[string], fields[object])
// example
var object = $D.store.get("WebUser", "7967", {fields: ["phone", "role"]});
// object == { role: "candidate,admin", phone: "79670190000", id: "7967" }$D.store.save() Saving an object
$D.store.find Searching for objects
filters (the second argument) syntax is the same for API-filtering raw mode
Result is an array of objects.
$D.store.export() For exporting data to Excel
The contract is absolutely identical to $D.store.find
Result = URL to the XLS-file.
$D.console.log() Console logging
Dealing with context variables
Additional functions
$D.fs.download() Saving files to the internal file storage
This function downloads and saves files to the File storage.
$D.fs.saveText() Saving text to file
Function returns link to the file in Dirctual storage
$D.image.resize() Resizing images
This function resizes images and saves the result to the File storage
$D.concat() Adding an element into array while avoiding duplication
$D.splice() Removing elements from an array
$D.hash.md5(), $D.hash.bcrypt(), $D.hash.sha256()
$D.arrayContainsAny() Checking if an array contains at least one element
$D.arrayContainsAll() Checking if an array contains all elements
$D.json.fromXML() Converting XML to JSON
$D.system.refreshIndex("servers") for reindexing fields
JWT Methods
Encode
If the 'expiration' (exp field) is undefined, set the current timestamp in seconds based on UTC time.
Decode
If the expiration date is earlier than the current time, this function will throw an exception.
Last updated