Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Altered:
Function [other Function type actions]
Item [operators of similar scope]
Data manipulation [other Data manipulation operators]
Baseline
9.1.0
create(name)
This creates a new note called name at the designated location, and returns the full path to that note. If the designated note already exists, no new note is created and the operator returns the empty string.
From v9.1.0, the create() operator always returns the path to the new (or pre-existing) note. Previously, if the note already existed, create() returned false.
This function needs no left-side expression argument, i.e. '$SomeAttribute=', to invoke it.
name is typically actually a complete path:
create("/hardware/taps");
but if name is a unique note $Name, a new note is created as a child of the current note. For example:
create("taps");
create(/path/to/container, name)
A two-argument variant is also offered that allows the container for a new item to be specified, and the new item's $Name. This may be useful if you need to create several notes in the same container, for example is iterating a list with .each(). For example:
create("/hardware","taps");
Or, more pertinently, using a loop variable 'aPlace':
$SomeList.each(xPlace){
create(aPlace,"urgentTasks");
};
Essentially, the two-input form allows 3 forms of variation:
- different path, different name (via two nested loops—one for paths, one for names)
- different path, same name (loop with path variants)
- same path, different name (loop with name variants)
Designators and evaluation
From v9.1.0, paths like that below, which mix literal and computed values are no longer evaluated, nor are inline designators:
create(/Resources/Test/$MyString)
Instead use code like this:
var path="/Resources/Test/"+$MyString;
create(path);