# Split payload data based on message data type

**URL:** <https://forums.losant.com/t/split-payload-data-based-on-message-data-type/5414>\
**Category:** Help\
**Tags:** opc-ua\
**Created:** [February 12, 2024, 12:42pm UTC](https://forums.losant.com/t/split-payload-data-based-on-message-data-type/5414 "2024-02-12T12:42:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sasikumar\_Rajendran](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Sasikumar\_Rajendran](https://forums.losant.com/u/Sasikumar_Rajendran)\
**Post date:** [February 12, 2024, 12:42pm UTC](https://forums.losant.com/t/split-payload-data-based-on-message-data-type/5414/1 "2024-02-12T12:42:26Z")

</div>

Incoming message from OPCUA Trigger node in below format.

“data”: {  
“identifier”: “s=gIoT.Order.Specification”,  
“namespace”: “6”,  
“sourceTimestamp”: “2024-02-12T10:09:29.631Z”,  
“timestamp”: “2024-02-12 15:39:29”,  
“value”: “kk”  
},

How can I split the values based on data type, i.e. data.value will vary with respect to identifier, which will be (int, Bool, string, float, timestamp), etc.? I tried conditional node but am not sure where to mention data type to compare.

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [February 12, 2024, 1:44pm UTC](https://forums.losant.com/t/split-payload-data-based-on-message-data-type/5414/2 "2024-02-12T13:44:28Z")

</div>

I would use the [Split operator in the String Node](https://docs.losant.com/workflows/logic/string/#split) on the `data.identifier` property, splitting on the `=` character, which would allow you to determine the type based on that first character. Following that, I would use a [Switch Node](https://docs.losant.com/workflows/logic/switch/) to take one of four paths for the different identifier types (cases for `s`, `i`, `g`, and `b`).

---

<div class="post-metadata">

**Author:** ![Sasikumar\_Rajendran](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Sasikumar\_Rajendran](https://forums.losant.com/u/Sasikumar_Rajendran)\
**Post date:** [February 12, 2024, 2:22pm UTC](https://forums.losant.com/t/split-payload-data-based-on-message-data-type/5414/3 "2024-02-12T14:22:09Z")

</div>

In this case, the data.identifier is merely a tag name, and it does not change with respect to the type of value. It is independent of data.value so it requires a filter based on the data type in data.value.

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [February 12, 2024, 2:30pm UTC](https://forums.losant.com/t/split-payload-data-based-on-message-data-type/5414/4 "2024-02-12T14:30:00Z")

</div>

Then you can use the [`{{typeof}}` helper](https://docs.losant.com/workflows/accessing-payload-data/#typeof-val) to determine the data type. Just be aware that this will not do any sort of type casting for you - as in, a payload of …

```json
{
  "data": {
    "value": "4"
  }
}

```

… will return “string” for `{{typeof data.value}}`.
