Accessing Data
The Function Development Kit (FDK) provides high-level access to the project graph.
Selecting entities
Data access usually starts by selecting an entity.
Selecting the project entity
var project = diafunc.project(); Selecting an entity by id
var entity = diafunc.entity("entity-id");Reading & writing attributes
Attributes are a common way to represent information in the project graph, so most analyses and changes of project data read or write attributes.
Reading an attribute
var attribute = entity.attribute("attributeName");
var text = attribute.text();
var number = attribute.number(); Writing an attribute
entity.attribute("attributeName").set("attributeValue");
//alternative:
entity.attribute("attributeName", "attributeValue");Creating new entities
New entities are usually immediately linked to an existing source entity when created.
Creating a new entity
var newEntity = sourceEntity.addLinked("linkId");
//with specific id:
newEntity = sourceEntity.addLinked("linkId", "entityId");Removing entities
One call removes an entity.
Removing an entity
entity.remove();