Nube iO - Rubix Wires: Data Types

Rubix Wires: Data Types


Rubix Wires has data types: Null, Boolean, Numeric, JSON, and String.  Node input and output values have data types which dictate how they are interpreted.  Although there is built in type checking and type conversion, it is always best to ensure that values being passed between linked nodes are of the intended data type.

Data Types

Boolean

Booleans are two state (digital) values. In Rubix Wires Boolean values are passed as ‘true’ or ‘false’.  These could be equivalent to ON/OFF, START/STOP, RUNNING/STOPPED, YES/NO, ….

Numeric

Numerics are number values. They can be integers, or have decimal values.

String

Strings are text values made of characters. Strings can contain numbers but those numbers will be interpreted as text characters.

JSON

JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays. It is a common data format with diverse uses in electronic data interchange.

Null

Null is a valid value within Rubix Wires. Null can be used when passing a message where no Boolean, Numeric, or String value is appropriate. For most nodes, when Null is passed into it that input will be ignored, or Null will be passed on.  However, if an input value is required for the node to operate, the node will not function. Null values can be generated by any ‘constant’ type node in the ‘Points’ category; It can also be entered directly into many node settings fields.

For Boolean settings fields, null will be selectable from a drop-down option when applicable:

For Numeric and String settings fields null will be passed when the settings field is left blank:


Data Type Intercompatibility

Boolean to Numeric

If a Boolean value is passed to a Numeric input:
  1. Boolean `true` will be interpreted as Numeric 1.
  2. Boolean `false` will be interpreted as Numeric 0.

Boolean to String

If a Boolean value is passed to a String input:
  1. Boolean `true` will be interpreted as String `true`.
  2. Boolean `false` will be interpreted as String `false`.

Numeric to Boolean

If a Numeric value is passed to a Boolean input:
  1. Numeric 0 will be interpreted as Boolean `false`.
  2. Numeric 1 will be interpreted Boolean `true`.
  3. All other Numeric values will be interpreted as Boolean `false`.

Numeric to String

If a Numeric value is passed to a String input it will be interpreted as the String value of the Numeric. For example Numeric 1234 passed to a String input will be interpreted as String `1234` (a string of text.)

String to Boolean

If a String value is passed to a Boolean input:
  1. String `true` or String 1 will be interpreted as Boolean `true`.
  2. All other String values will be interpreted as Boolean `false`.

String to Numeric

If a String value is passed to a Numeric input:
  1. If the leading portion of the String value is a number (eg. ‘123hello’), then it will be interpreted as a Numeric with the value of the leading numeric portion (eg. String ‘123hello’ will be interpreted as Numeric 123).  This can include decimal values (eg. String ‘123.45hello’ will be interpreted as Numeric 123.45).
  2. Numeric portions of String values that come after a text (non-numbers) will be ignored (eg. String’ 123hello789’ will be interpreted as Numeric 123).
  3. String values that do not have a leading numeric portion will be interpreted as Null.

Data Type Checking

To ensure that the appropriate data types are passed, the ‘Type-Check’ node is available in the ‘Compare’ node category.  This node has settings to select which data type you want to check for.  It also has an output that will output the actual data type of the input.


Related Articles

  1. Rubix Wires: Getting Started Guide



    • Related Articles

    • Rubix Wires: Compare Nodes

      This article describes the Rubix Wires nodes that are in the Compare category.  Compare The `Compare` category contains nodes that provide numerical and data type comparisons with Boolean results. Equal This node performs an equivalency operation on ...
    • Rubix Platform: Overview

      Introduction To Rubix Platform Rubix Platform is the browser based user interface for many of the Nube-iO services. Rubix Platform is the main management tool for configuring Local/Remote Device Settings, Sensor Gateway Connectivity, Data Management, ...
    • Rubix Platform: Managing Apps/Services

      Rubix Platform provides utilities to install, update, and manage the various Apps and Services that run on the Rubix Controller.  Preparation: Rubix Platform: Navigation Rubix Platform: Access and Login Available Apps and Services Apps Apps are ...
    • Rubix Wires: Overview

      Introduction to Rubix Wires Rubix Wires is Nube-iOs browser based logical programming environment. It is a function block flow editor, so there is no coding required to make advanced control and monitoring programs. This type of visual programming ...
    • Rubix Wires: Getting Started Guide

      Introduction to Rubix Wires Rubix Wires is Nube-iOs browser based logical programming environment.  It is a function block flow editor, so there is no coding required to make advanced control and monitoring programs.  This type of visual programming ...