Tinderbox v9 Icon

createAgent([containerStr, ]nameStr)

Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

Operator Has Optional Arguments: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Document configuration  [other Document configuration operators]


 As at baseline

 [More on optional operator arguments]


This creates a new agent called nameStr at the designated location, and returns the full path to that agent. If the designated agent already exists, no new agent is created and the operator returns the empty string.

The create() operator always returns the path to the new (or pre-existing) agent.

This function needs no left-side expression argument, i.e. '$SomeAttribute=', to invoke it.

nameStr is typically actually a complete path:


but if name is a unique agent $Name, a new agent is created as a child of the current note. Be aware though that cannot be used if the current object is an agent rather than a note. For example:


create(containerStr, nameStr)

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 agents in the same container, for example is iterating a list with .each(). For example:


Or, more pertinently, using a loop variable 'aPlace':


Essentially, the two-input form allows 3 forms of variation:

Designators and evaluation

Paths like that below, which mix literal and computed values are not evaluated, nor are inline designators:


Instead use code like this:

	var:string vPath="/Resources/Test/"+$MyString;