# GetLastSequence

Calling this method retrieves the results of the last sequence performed.

### **Method Name:**

GetLastSequence

### **Payload:**

The direct command only requires an empty payload.

```
{
}
```

### **Return value**

The direct command returns a **workflowResult**, containing the following properties:

**id** : Unique id of the last workflow

**workflowid** : Name of the sequence / workflow

**startTime** : Start time of sequence in UTC

**endTime** : End time of sequence in UTC

**workflowStatus** : Result of the last sequence (ok, failed, abandoned ..)

**states** : The workflow states that variables that are stored and available during the workflow execution. Some of these states are default states, that are always there, and other states are collected or generated by other step activities. Default states that are always present are:

* **workflowid**: Name of the sequence / workflow.
* **id**: Unique id of the workflow
* **pixelformat**: Pixel format as configured on the camera interface. Currently supports Mono8, Mono10p, Mono12p, Mono10, BayerRG8, Mono16, RGB24 and RGB48
* **imageHeight**: Image height in pixels, as configured on the camera interface
* **imageWidth**: Image width in pixels, as configured on the camera interface
* **cameraVendor**: Camera vendor read from camera interface
* **cameraModel**: Camera model read from camera interface
* **workingDirectory**: Directory where the files from the workflow are stored. This is the same folder, that is uploaded to cloud.

**executionPath** : Steps / Activities that were executed in the sequence, including the following details

* **stepId**: Id of the step, where step 0 is the initial step. Steps are executed in order, with the exception of branches (by branch step or on error)
* **activityType**: Type of activity executed in the step
* **activityResult**: Result of the activity execution (Success / Failed)
* **errorDescription**: Additional details, in the event of an error in the activity execution
* **executionStarted**: Start time of the activity execution in UTC
* **executionEnded**: End time of the activity execution in UTC
* **duration**: Execution time in the format hh:mm:ss.xxxxxxx, where xxxxxxx are in 100 nS resolution

**stepsPerformed** : Number of steps that are executed during the sequence

**stepsFailed** : Number of steps that failed during execution of the sequence

**invalidStates** : Steps with configuration (parameters) that do not validate.

Here is an example return value:

```
"workflowResult": {
    "id": "7b3fd8c4-9ea8-4107-bc6f-5626f248a65b",
    "workflowId": "1",
    "startTime": "2023-04-28T13:28:23.52229+00:00",
    "endTime": "2023-04-28T13:28:24.0321905+00:00",
    "workflowStatus": "Success",
    "states": {
        "workflowid": "1",
        "id": "7b3fd8c4-9ea8-4107-bc6f-5626f248a65b",
        "pixelformat": "Mono8",
        "imageheight": "2048",
        "imagewidth": "2048",
        "cameravendor": "SICK",
        "cameramodel": "I2D605C-2MCB71",
        "Factory1.Line1.SoecId": "18",
        "Factory1.Line1.Validity": "1",
        "Factory1.Line1.PassFail": "6",
        "Factory1.Line1.PassFailInfo": "7",
        "workingdirectory": "/images/history/2023-04-28-13-28-24",
        "succeeded": "1"
    },
    "stepsPerformed": 16,
    "stepsFailed": 0,
    "invalidStates": [],
    "executionPath": [
    {
        "stepId": 0,
        "activityType": "SetState",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:23.5222981+00:00",
        "executionEnded": "2023-04-28T13:28:23.5229727+00:00",
        "duration": "00:00:00.0006746"
    },
    {
        "stepId": 1,
        "activityType": "SetScene",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:23.5233325+00:00",
        "executionEnded": "2023-04-28T13:28:23.5605164+00:00",
        "duration": "00:00:00.0371839"
    },
    {
        "stepId": 2,
        "activityType": "AcquireImage",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:23.5608508+00:00",
        "executionEnded": "2023-04-28T13:28:23.6343601+00:00",
        "duration": "00:00:00.0735093"
    },
    {
        "stepId": 3,
        "activityType": "SetScene",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:23.634666+00:00",
        "executionEnded": "2023-04-28T13:28:23.6721489+00:00",
        "duration": "00:00:00.0374829"
    },
    {
        "stepId": 4,
        "activityType": "AcquireImage",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:23.6724749+00:00",
        "executionEnded": "2023-04-28T13:28:23.7459887+00:00",
        "duration": "00:00:00.0735138"
    },
    {
        "stepId": 5,
        "activityType": "SetScene",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:23.7463333+00:00",
        "executionEnded": "2023-04-28T13:28:23.7838737+00:00",
        "duration": "00:00:00.0375404"
    },
    {
        "stepId": 6,
        "activityType": "AcquireImage",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:23.784207+00:00",
        "executionEnded": "2023-04-28T13:28:23.8576059+00:00",
        "duration": "00:00:00.0733989"
    },
    {
        "stepId": 7,
        "activityType": "SetScene",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:23.8579298+00:00",
        "executionEnded": "2023-04-28T13:28:23.8956263+00:00",
        "duration": "00:00:00.0376965"
    },
    {
        "stepId": 8,
        "activityType": "AcquireImage",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:23.895955+00:00",
        "executionEnded": "2023-04-28T13:28:23.9693192+00:00",
        "duration": "00:00:00.0733642"
    },
    {
        "stepId": 9,
        "activityType": "SetScene",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:23.9708028+00:00",
        "executionEnded": "2023-04-28T13:28:24.0082649+00:00",
        "duration": "00:00:00.0374621"
    },
    {
        "stepId": 10,
        "activityType": "ExecuteModel",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:24.0085953+00:00",
        "executionEnded": "2023-04-28T13:28:24.0244314+00:00",
        "duration": "00:00:00.0158361"
    },
    {
        "stepId": 11,
        "activityType": "PublishState",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:24.0248117+00:00",
        "executionEnded": "2023-04-28T13:28:24.0259413+00:00",
        "duration": "00:00:00.0011296"
    },
    {
        "stepId": 12,
        "activityType": "PublishState",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:24.0263389+00:00",
        "executionEnded": "2023-04-28T13:28:24.0275038+00:00",
        "duration": "00:00:00.0011649"
    },
    {
        "stepId": 13,
        "activityType": "PublishState",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:24.0278729+00:00",
        "executionEnded": "2023-04-28T13:28:24.0289094+00:00",
        "duration": "00:00:00.0010365"
    },
    {
        "stepId": 14,
        "activityType": "WrapResult",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:24.0292334+00:00",
        "executionEnded": "2023-04-28T13:28:24.0304705+00:00",
        "duration": "00:00:00.0012371"
    },
    {
        "stepId": 15,
        "activityType": "EndWorkflow",
        "activityResult": "Success",
        "errorDescription": "",
        "executionStarted": "2023-04-28T13:28:24.0308275+00:00",
        "executionEnded": "2023-04-28T13:28:24.0314494+00:00",
        "duration": "00:00:00.0006219"
    } 
    ]
}
```


---

# Agent Instructions: 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:

```
GET https://docs.tricloudnexus.io/edge/nexus-modules/data-connector-modules/scenecontrollermodule/direct-commands/getlastsequence.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
