Skip to main content
Documentation

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 within the project graph.
So reading and writing them is essential to analyze and modify the project data.
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

Removing entities is quite easy.
Removing an entity
entity.remove();

What next?