# OMRON FINS Reading REAL & STRING Data Types

**URL:** <https://discourse.nodered.org/t/omron-fins-reading-real-string-data-types/66038>\
**Category:** Industrial\
**Created:** [4 August 2022 20:09 UTC](https://discourse.nodered.org/t/omron-fins-reading-real-string-data-types/66038 "2022-08-04T20:09:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mihaila-andreas](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@mihaila-andreas](https://discourse.nodered.org/u/mihaila-andreas)\
**Post date:** [4 August 2022 20:09 UTC](https://discourse.nodered.org/t/omron-fins-reading-real-string-data-types/66038/1 "2022-08-04T20:09:03Z")

</div>

Hi there,

Just wanted to know how I can read STRING and REAL data types via FINS.

INT and BOOL are working fine.

Do I need to parser it? Does somebody have got some example nodes?

Best thanks in advance

Andy

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [4 August 2022 20:35 UTC](https://discourse.nodered.org/t/omron-fins-reading-real-string-data-types/66038/2 "2022-08-04T20:35:48Z")

</div>

From the documentation here: [node-red-contrib-omron-fins (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-omron-fins)

Example flows have been included to help you get started. In the node-red editor, click the hamburger menu, select **import** then **examples** (or press ctrl+i)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [4 August 2022 21:36 UTC](https://discourse.nodered.org/t/omron-fins-reading-real-string-data-types/66038/3 "2022-08-04T21:36:58Z")

</div>

In the readme that @HaroldPetersInskipp linked to mentions a helper node "buffer parser" that is like a sister node for all this.

If you want technical reasons - FINS protocol only does bits and WORDS so something has to parse the data & as I wrote in the readme...

> ### Data formats and conversion
> 
> As I use multiple PLCs and didn't want to write boolean / 32bit / float / double functionality into each node (it's best to keep things atomic and good at what they do) so I wrote a separate second node for handling data conversions.
> 
> This node "node-red-contrib-buffer-parser" [node-red-contrib-buffer-parser (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-buffer-parser) is capable of pretty much anything you will need for this or any PLC that returns 16bit data or a NodeJS Buffer.

---

<div class="post-metadata">

**Author:** ![mihaila-andreas](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@mihaila-andreas](https://discourse.nodered.org/u/mihaila-andreas)\
**Post date:** [5 August 2022 04:06 UTC](https://discourse.nodered.org/t/omron-fins-reading-real-string-data-types/66038/4 "2022-08-05T04:06:20Z")

</div>

Hi Guys,

many thanks for this information.

I will launch some test 🙂

Best greetings,

Andy

---

<div class="post-metadata">

**Author:** ![mihaila-andreas](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@mihaila-andreas](https://discourse.nodered.org/u/mihaila-andreas)\
**Post date:** [5 August 2022 09:55 UTC](https://discourse.nodered.org/t/omron-fins-reading-real-string-data-types/66038/5 "2022-08-05T09:55:29Z")

</div>

Hi there,

I had success with getting the data of my CJ2M Reals and Strings 🙂

Another problem .. I would like to host the data in one MSSQL DB but always getting syntax error ...

Do you have some advices?

I am just sharing my node with you:

```auto
[
    {
        "id": "ec9cf53f5ff54f3b",
        "type": "tab",
        "label": "FINS to MS SQL",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "0d29b076a5b30a0f",
        "type": "inject",
        "z": "ec9cf53f5ff54f3b",
        "name": "Query FINS to CJ2M",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 270,
        "y": 390,
        "wires": [
            [
                "4f1161ae4a5f53c5"
            ]
        ]
    },
    {
        "id": "4f1161ae4a5f53c5",
        "type": "FINS Read",
        "z": "ec9cf53f5ff54f3b",
        "name": "Read 8 Words from CJ2M PLC",
        "connection": "cb0566115f7073ac",
        "addressType": "str",
        "address": "D0",
        "countType": "num",
        "count": "8",
        "msgPropertyType": "msg",
        "msgProperty": "payload_to_Buffer",
        "outputFormatType": "buffer",
        "outputFormat": "",
        "x": 520,
        "y": 390,
        "wires": [
            [
                "44daa4972f363279"
            ]
        ]
    },
    {
        "id": "e1dc3da53a8c42d6",
        "type": "debug",
        "z": "ec9cf53f5ff54f3b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1030,
        "y": 420,
        "wires": []
    },
    {
        "id": "bde6896c9aa88707",
        "type": "MSSQL",
        "z": "ec9cf53f5ff54f3b",
        "mssqlCN": "a05e2c4980b5eb14",
        "name": "Insert Into Query",
        "query": "DECLARE @Bool_Test bit\nDECLARE @Int_Test int\nDECLARE @Real_Test real\nDECLARE @String_Test varchar(11)\n\nSET @Bool_Test = {{{payload.Bool_T[0]}}};\nSET @Int_Test = {{{payload.Int_T}}};\nSET @Real_Test = {{{payload.Real_T}}};\nSET @String_Test = {{{payload.String_T}}};\n\nINSERT INTO CJ2M_NodeRed\n\n (\n CurrentTime, \n Bool_Test,\n Int_Test,\n Real_Test,\n String_Test\n )\n \n VALUES \n \n (\n CURRENT_TIMESTAMP,\n @Bool_Test,\n @Int_Test,\n @Real_Test,\n @String_Test\n )",
        "outField": "payload",
        "x": 1050,
        "y": 345,
        "wires": [
            []
        ]
    },
    {
        "id": "44daa4972f363279",
        "type": "buffer-parser",
        "z": "ec9cf53f5ff54f3b",
        "name": "buffer to key/value object",
        "data": "payload_to_Buffer",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "bool",
                "name": "Bool_T",
                "offset": 1,
                "length": 16,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "int16be",
                "name": "Int_T",
                "offset": 2,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "floatbe",
                "name": "Real_T",
                "offset": 6,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "string",
                "name": "String_T",
                "offset": 8,
                "length": 10,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "keyvalue",
        "resultTypeType": "output",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": false,
        "outputs": 1,
        "x": 785,
        "y": 390,
        "wires": [
            [
                "e1dc3da53a8c42d6",
                "bde6896c9aa88707"
            ]
        ]
    },
    {
        "id": "cb0566115f7073ac",
        "type": "FINS Connection",
        "name": "CJ2M",
        "host": "192.168.1.201",
        "port": "9600",
        "MODE": "",
        "MODEType": "CJ",
        "protocol": "",
        "protocolType": "tcp",
        "ICF": "0x80",
        "DNA": "",
        "DA1": "201",
        "DA2": "",
        "SNA": "",
        "SA1": "179",
        "SA2": "",
        "autoConnect": true
    },
    {
        "id": "a05e2c4980b5eb14",
        "type": "MSSQL-CN",
        "name": "MS SQL Server",
        "server": "localhost",
        "encyption": true,
        "database": "NX102_DB"
    }
]

```

Many thanks,

Andy

![screen_MSSQL](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/7305abb09ede704e8e07ecb4a1880029a9dd75c2.png)  
 ![screen_MSSQL_debug](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/3/231eea718336e4679f63682e56bc3f26601dad15.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 August 2022 10:14 UTC](https://discourse.nodered.org/t/omron-fins-reading-real-string-data-types/66038/6 "2022-08-05T10:14:40Z")

</div>

Change your query to use parameters.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/1/819fc6c375506148ec58513a777b6631c2fc691c.png)

---

<div class="post-metadata">

**Author:** ![mihaila-andreas](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@mihaila-andreas](https://discourse.nodered.org/u/mihaila-andreas)\
**Post date:** [10 August 2022 06:50 UTC](https://discourse.nodered.org/t/omron-fins-reading-real-string-data-types/66038/7 "2022-08-10T06:50:28Z")

</div>

Hi there,

many thanks it does work 🙂

Best greetings,

Andy

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 August 2022 06:51 UTC](https://discourse.nodered.org/t/omron-fins-reading-real-string-data-types/66038/8 "2022-08-24T06:51:23Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
