Formula Node: Undefined Variable Error in LabVIEW

Updated Sep 19, 2022

Reported In


  • LabVIEW Base

Issue Details

I am using the Formula Node in LabVIEW, but I am getting a broken run arrow with a message that says “Formula Node: undefined variable.” I have checked my code and I have no incomplete lines. My code worked previously in a text-based environment. Why won’t it work in LabVIEW?


There is no default data type for variables using the Formula Node in LabVIEW. As a result, it is necessary to define the type of every variable called or created in the Formula Node.

Additional Information

It is useful to define two types of variables here: Input Variables, and Implicit Variables.

Input Variables
When an input is created on the formula node by right-clicking and selecting Add Input, the wire type that is wired to that input node defines the type of that variable. In the figure below you can see that the variables in the Formula Node are type defined based on the data type wired to each respective input.

Implicit Variables
An Implicit Variable is a variable that is created in the formula node as a consequence of the code.  When a variable is created in the Formula Node as the result of some operation from two previously defined variables, it is not automatically defined. Refer to the figures below.

The block diagram shows a broken arrow, even though the text code might look OK. The Error list above shows that the variable Z is undefined. This can be fixed either by declaring an output variable or by programmatically defining the variable. 

Output Variable
By making an implicit variable an output of the Formula Node, it will be defined as a Double Precision type, regardless of the type of the variables used to create the new variable (e.g. X and Y are Long (signed 32-bit), but Z is a Double. See below).
You can programmatically define variables by using the following commands and syntax.
Data TypeDBLSGLI8I16I32U8U16U32
Commandfloat, float 64float32int8int16int, int32uInt8uInt16uInt32
Syntaxfloat x, float64 xfloat32 xint8 xint16 xint x, int32 xuInt8 xuInt16 xuInt32 x

The following figure shows this implemented. This is useful to set the output type of a variable to something other than Double. It also makes it unnecessary to wire each variable in the text code to an output to be defined.