Split payload data based on message data type

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.

I would use the Split operator in the String Node 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 to take one of four paths for the different identifier types (cases for s, i, g, and b).

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.

Then you can use the {{typeof}} helper 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 …

  "data": {
    "value": "4"

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