--- alias: user-guide-automation-task-core-synchronize tags: - automation tasks description: "This task facilitates data synchronization between tasks, managing inputs and outputs dynamically" --- # Synchronize ![synchronize](../images/synchronize-lg.svg) The task `Synchronize` is used to synchronize data between tasks. ![Screenshot showing a screen with a title "Synchronize".](../images/synchronize_1.png) ## Inputs | Name | Data Type | Values | Description | | --------------- | ---------- | ------ | ------------------------------------------------------------ | | `` | `` | | Inputs to synchronize | | `Auto Input` | `None` | | Create a new Input and output based on the origin of the link | | Activate | `Any` | | Activates the task execution | ## Outputs | Name | Data Type | Values | Description | | --------------- | ---------- | ------ | ------------------------------------------------------------ | | `` | `` | | outputs synchronized | | `Auto Output` | `None` | | Create a new Output and Input based on the target of the link | | Success | `Boolean` | | If there was no problem emits a true | | Error | `Error` | | Error that occurred during the processing of this task | ## Auto Inputs/Outputs This Task has implemented an automatic creation of dynamic inputs/outputs that dramatically reduce the configuration time. The behavior is rather simple. Just link to the `Link here to add new` input and a copy of the origin is created (same name and data type) and the link is also created between the two elements. Also, you can drag the `Link from here to add new` output into an input of another task to create a new output of the same name and type and link them. ![Screenshot showing a UI with an input field labeled "Link here to add new input".](../images/Synchronize_Auto_Mini.gif) ## Settings In the `General` Tab, you have the usual settings and the following options settings: | Name | Data Type | Values | Default | Description | | ---------------------- | --------- | ----------------- | ------- | ------------------------------------------------------------ | | Expiration Time | `Integer` | | 60000 | Maximum amount of time (in milliseconds) to keep the inputs until the `Activate` is triggered | | Emit when all define | `Boolean` | | `False` | Only emit the outputs when all inputs are filled within the same zone/context | ![Screenshot showing a settings page with a table listing "Name", "Data Type", "Values", "Default", and "Description" columns, including an entry for "cones".](../images/synchronize_2.png) In the `Inputs/Outputs` Tab, you have the following options settings: | Name | Data Type | Values | Default | Description | | --------------- | --------- | ------------------------------------------------------------ | ------- | ----------------------------------------------- | | Name | `String` | | | Name of the input and output | | Friendly Name | `String` | | | Text that will be displayed in the input/output | | Type | `enum` | `Long`
`Decimal`
`DateTime`
`Boolean`
`String`
`Integer`
... | | Type of the input/output value | | Collection Type | `enum` | `None`
`Array`
`Map` | | The Collection type of the input/output | ![Screenshot showing a settings page with options for collection type, including None, Array, and Map.](../images/synchronize_3.png) ## Behavior The top example, shows an equipment interface that uses the same event for both loader and unloader. The only way to identify which scenario we are handling, is by the `$Port` variable supplied by the event. Now, let's imagine both occurrences happen at the same time and you want to make sure that the Loader performs a `TrackIn` and the Unloader a `TrackOut`. Without the `Synchronize` Task, it would require far more logic/Tasks to make sure the `$MagazineId` variable would be the correct one on the `TrackIn` and `TrackOut` respectively. Depending on the settings, the outputs will emit their values when the `Activate` input is triggered immediately or only if all inputs are filled. If during the specified timeout period the `Activate` is not triggered, all the input values received will be discarded. ## Remarks This task uses a specific structure of context-based data called `zone`. More information on this topic can be read in the [Zones](../../../zones.md) page.