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

https://guild-uploads.s3.amazonaws.com/optimized/1X/641ffe1ec32fb18791cd5bc0ea9555a5f991867f_1_510x499.gif

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.

Questions or comments about this page?

Add a Topic