Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

Use the Goto…Label structure in a Math worksheet

  • Last UpdatedOct 29, 2026
  • 3 minute read

You can use the Goto and Label system tags to create a Goto…Label structure, which controls the flow of program logic in a Math worksheet.

Note: The Goto…Label structure can be used only in Math worksheets. It cannot be used in any other Built-in Language interface, such as an ActiveX or .NET Control object, a Command animation, or Screen Logic (in Screen Properties).

The rows of a Math worksheet are executed sequentially from first to last. If a Goto tag is encountered, however, it causes the execution to go to the matching Label tag in the same worksheet. "Matching" in this case means the Goto and Label tags have the same value at the moment when the Goto tag is encountered.

The Goto and Label tags are somewhat different from other system tags. Their names are reserved by the system, so that you cannot use the same names for your project tags, but their values are not defined by the system. Instead, you define their values when you configure them in a Math worksheet.

In their most basic usage, the Goto and Label tags can have the same literal value (either numerical or string). In the example below, the execution encounters a Goto tag in the first row, evaluates the corresponding expression to get the literal value "end", and then goes to the matching Label tag in the last row.

GOTO goes directly to the end of the sheet

Of course, if the execution goes directly from the first row to the last row, all of the rows in between are ignored and the worksheet serves no real purpose. The key to the Goto…Label structure is to configure the expression for the Goto tag so that it performs some sort of program logic. In the next example, the first Goto tag is configured to get the value of a project tag (for example, MyInteger[0]), and then the execution goes to the Label tag that has the same value (for example, either 1 or 2).

GOTO gets the value of a project tag

From there, you can develop the expression further to perform more complex program logic. In the final example, the If function is used to not only get the value of a project tag but also test it for some condition.

GOTO gets the value of a project tag and then tests it

In this way, using the Goto…Label structure, you can configure multiple sub-routines in a single Math worksheet and then use program logic to go from one to the next.

Please be aware that if a Goto tag does not have a matching Label tag — that is, if the execution encounters a Goto tag but cannot find a Label tag that has the same value — then a message will be sent to the project runtime log and the execution will continue to the next row after the Goto tag. You should thoroughly test each Goto…Label structure to make sure there is a matching Label tag for every possible value of the Goto tag.

Note: Technically, the data type of the Goto and Label tags is String, which means they can only receive string values. If a Goto or Label tag receives a numerical value — either a literal value or a value returned by evaluating a tag/expression — that value is converted to a string value before it is actually stored in the tag. This conversion should have no practical effect on the runtime performance of your project, however, because the Goto and Label tags should not be used in any other context.