# OPC UA Compact Server , how to create int variable for node

**URL:** <https://discourse.nodered.org/t/opc-ua-compact-server-how-to-create-int-variable-for-node/80734>\
**Category:** General\
**Tags:** function-node\
**Created:** [23 August 2023 07:26 UTC](https://discourse.nodered.org/t/opc-ua-compact-server-how-to-create-int-variable-for-node/80734 "2023-08-23T07:26:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DarylLee1601](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daryllee1601/32/82206_2.png) [@DarylLee1601](https://discourse.nodered.org/u/DarylLee1601)\
**Post date:** [23 August 2023 07:26 UTC](https://discourse.nodered.org/t/opc-ua-compact-server-how-to-create-int-variable-for-node/80734/1 "2023-08-23T07:26:44Z")

</div>

I am creating a OPC UA node for OPC UA Compact Server  
From the example, i able to use the string or double. but unfortunely my new project request me to use a int32, how can i create a node in int32?

```js
const m20230703 = namespace.addVariable({
      "organizedBy": opcUASubFolder102,
      "browseName": "OM_SortingId",
      "nodeId": "ns=1;s=OM_SortingId",
      "dataType": "Double",
      "value": {
        "get": function () {
          return new Variant({
            "dataType": DataType.Double,
            "value": flexServerInternals.sandboxFlowContext.get("OM_SortingId")
          });
        },
        "set": function (variant) {
          flexServerInternals.sandboxFlowContext.set(
            "OM_SortingId",
            parseInt(variant.value)
          );
          return opcua.StatusCodes.Good;
        }
      }
    });

```

---

<div class="post-metadata">

**Author:** ![mikakaraila](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikakaraila/32/37496_2.png) [@mikakaraila](https://discourse.nodered.org/u/mikakaraila)\
**Post date:** [27 August 2023 08:27 UTC](https://discourse.nodered.org/t/opc-ua-compact-server-how-to-create-int-variable-for-node/80734/2 "2023-08-27T08:27:41Z")

</div>

Int32 instead of Double

---

<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:** [26 October 2023 08:27 UTC](https://discourse.nodered.org/t/opc-ua-compact-server-how-to-create-int-variable-for-node/80734/3 "2023-10-26T08:27:42Z")

</div>

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