> For the complete documentation index, see [llms.txt](https://docs.tricloudnexus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tricloudnexus.io/edge/nexus-modules/data-connector-modules/scenecontrollermodule/sequences/workflow-triggers.md).

# Workflow Triggers

## Sequence Triggers

The sequence workflows can be set to be triggered by different mechanisms. However, a workflow can only run in one instance, so if a workflow is triggered again before the former workflow has completed, the execution will be skipped.\
The different triggers are:

### Direct Command Trigger

This trigger ensures that the sequence workflow is only triggered by calling the a direct method on the SceneControllerModule. When triggering the sequence workflow, you need to specify the id of the sequence. Optionally, it is also possible to set an initial state, by specifying the state names and values, to be used in the workflow. The initial states are pre-loaded before the sequence workflow executes. This is convenient if integration to a control system should be simulated. The initial states can replace tag measurements coming from control systems (using data collector modules).

The direct command trigger is default, if nothing is specified in the sequence workflow. It is defined like this:

```
"trigger": 
{
    "type": "DirectCommand"
}
```

To execute the sequence workflow, use the following direct method on the SceneControllerModule:

**Method Name:**\
StartSequence

**Payload:**

```
{
    "id": "<sequence id>",
    "initialState": {
        "<state1>": "<value>",
        "<state2>": "<value>",
        ...
    }
}
```

### Schedule Trigger

Sequence workflows can be triggered periodically by setting an execution schedule. The schedule is set using a CRON string, and is configured in the sequence like this:

```
"trigger": 
{
    "type": "Schedule",
    "parameters": "0/30 * * * *"
}
```

To generate the cron expression string, the following cron expression generator can be used: <https://crontab.cronhub.io/> .

### OnTagChange Trigger

Sequence workflows can be set to trigger every time a tag value changes. The configuration of the sequence file should look like this:

```
"trigger": 
{
    "type": "OnTagChange",
    "parameters": "Factory1.Line1.Trigger"
}
```

In the above example, the workflow starts when the tag "Factory1.Line1.Trigger" changes. The tag must be valid in the asset hierarchy.

### OnEquationTrue Trigger

Another option to trigger a workflow sequence is to use a symbolic expression. The configuration of the sequence file should look like this:

```
"trigger": 
{
    "type": "OnEquationTrue",
    "parameters": "a+b>0#a=Factory1.Line1.Tag1;b=Factory1.Line1.Tag2"
}
```

The example shows a simple symbolic equation that is "a+b>0", where the value of "a" comes from the tag "Factory1.Line1.Tag1" and the value of "b" from "Factory1.Line1.Tag2". The symbolic equation should be constructed such that it returns either true or false. However, if an analog value is returned, then values between 0 and 0,5 are interpreted as false. All other values are interpreted as true. Tags must be valid in the asset hierarchy.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tricloudnexus.io/edge/nexus-modules/data-connector-modules/scenecontrollermodule/sequences/workflow-triggers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
