Introduction
Component Builder
Chatbot Module
Transforms
Transforms enable us to effectively spawn new Objects and add them to our Chart.
Transforms are effectively scripted or logical processes for generating one or more new Objects, of a certain type, as part of automated workflows and richer interactive User experiences.
Transform in Action
To create Transforms, we're dipping back into the Store actions that we looked at in the previous section.
We are going to make use of the object/create
and connection/create
to generate new Person Objects.
Step 1 - Generate Person Objects
const objectPromise = this.$store.dispatch('object/create', {
type: "AnalysisTools_PersonObject",
position,
info: {
title: sourceName,
settings: {
title: sourceName,
notesLines: [{
id: this.guid(),
type: "Text",
content
}]
}
}
})
This first step returns a Promise, which we can chain to the next action call.
Step 2 - Establish connections between generated Objects and the current Object.
objectPromise.then(createdObject => {
console.log('Created object: ' + createdObject.id);
this.$store.dispatch("connection/create", {
from: this.baseObject.id,
to: createdObject.id
});
})
To learn more about transforms and various examples, visit the Discussion on the Guild Community site.