Documentation Index

Fetch the complete documentation index at: https://docs.homag.cloud/llms.txt

Use this file to discover all available pages before exploring further.

Formulas and rules

Prev Next

For newly created jobs (job status = new), the values of columns can be calculated using formulas and rules. To define them, right-click on the name of the column in question in edit mode to open the context menu. You can use the context menu to set a value for the entire column or add formulas and rules.

This function is included from the productionManager Advanced version .

Öffnen des Kontextmenüs

Opening the context menu

Add Rule

When you create a rule, you start by defining a condition (1). To do this, select a column name, then specify an operator – such as equal, not equal to, greater (equals) or less than (equals) – and enter the desired value. You then specify which value should be assigned to the column if the condition (2) is true. The "+ And" option (3) allows you to add additional conditions to a rule. You can create new rules by clicking on "+ Add Rule" (4 ). In the "Other" field (5), specify the value to be used if none of the defined rules apply. To remove a rule, simply click on the red cross (6) next to the rule.

For example, you can use a rule to define the label layout of the parts.

Neue Regel hinzufügen

Add New Rule

Add Formula

With the help of the formula and rule editor integrated in the productionManager, you can use formulas to automatically calculate values of columns, check conditions or process texts. In the formula creation dialog box, select the columns required for the calculation from the "Available columns" list and double-click them into the formula. By clicking on "Confirm", you save the formula, which is then applied to the corresponding column.

Formulas have a wide range of applications. The following describes the possibilities for creating formulas in more detail and gives examples of each.

Note:

In general, a distinction is made between numbers and strings of data in formulas. Numbers are to be specified without thousands separators, with periods serving as decimal separators. Strings are identified by " ".

Features

Different functions can be used in formulas. These can usually be recognized by the trailing (), through which parameters are passed for the evaluation. Several parameters must be separated by a semicolon ( ; ) or comma ( , ).

Note:

You can nest and combine functions as often as you like, while adhering to the syntactic rules. Spaces and line breaks are not taken into account when calculating functions.

Mathematical functions

To process numbers, you can use the common basic mathematical and comparison functions.

Basic functions

+, -, *, /

Comparison Functions

Less than: <
Less than or equal to: <=
Greater than: >
Greater than or equal to: >=
Equals: =
Unequal: <>

Note:

Comparison functions return either 0 for a false statement or 1 for a correct statement. All comparison operators are also applicable to strings.

Example:

An example of the use of the basic functions is the calculation of the finished dimensions of components. If these are not already specified by an imported BOM, they can be calculated from the dimensions of the component when cut plus the thickness of the edges. The following is an example of how to calculate a finished width using the following formula:

Fertigbreite = [Breite] + [Kantendicke rechts] + [Kantendicke links]

Beispiel: Formel für Fertigbreite

Example: Formula for finished width

Logical Functions

In addition to the mathematical functions, there are also the following logical functions:

AND

Both conditions must be met

OR

At least one of the two conditions must be met

XOR

Exactly one of the two conditions must be met

NOT

Negates the argument

String functions

In addition to the comparison operators, the following functions are available for strings:

Function

Description

Example

&

Joining two strings

"HOMAG" & "machine" = "HOMAG machine"

UCASE("Text")

Convert all lowercase letters to uppercase

UCASE("machine") = "MACHINE"

LCASE("Text")

Convert all uppercase letters to lowercase

LCASE("HOMAG") = "homag"

LEFT("Text"; number) 

Specified number of characters from the left

LEFT("Wooden House"; 4) = "Wood"

RIGHT("Text"; number)

Specified number of characters from the right

RIGHT("wooden house"; 4) = "house"

MID("Text"; number; number)

Part of the string with start position and optional end position

MID("HOMAG Woodworking Systems";  6, 4) = "Wood"

LEN("Text")

String Length

LEN("HOMAG") = 5

ISEMPTY("Text")

1 if the string is empty, otherwise 0

ISEMPTY("") = 1

FIND("Text1"; "Text2"; number)

Searches a string for the occurrence of another string. Optionally, a starting position for characters to be skipped can be specified.

FIND("HOMAG Woodworking Systems"; "Wood";) = 6

RFIND("Text1"; "Text2"; number)

Analogous to FIND(), the search is done from back to front

 

REPLACE("Text"; "Text old"; "Text new")

Find and replace all old strings with a new string within the specified text

REPLACE("HOMAG Woodworking Systems"; "systems"; "machines") = "HOMAG woodworking machines"

INSERT("Text"; number; "Text new")

Reinserts the string into the string at the desired position

INSERT("HOMAG ", 6, "machine") = "HOMAG machine"

LTRIM("Text")

Removes all spaces at the beginning of the string

LTRIM("    HOMAG") = "HOMAG"

RTRIM("Text")

Removes all spaces at the end of the string

RTRIM("HOMAG    ") = "HOMAG"

Note:

Upper and lower case are generally considered.

Conditional expressions

The Formula Editor supports two conditional expression constructs when creating formulas. The IF-THEN-ELSE construct and the SWITCH-CASE-DEFAULT construct. 

Both options allow, to varying degrees, to perform a specific action depending on the value of a column.

The IF-THEN-ELSE construct

The IF-THEN-ELSE construct checks a condition and executes one of two alternative options depending on whether it is met or not.

   IF ConditionTHEN Command ELSE Alternative Command

If the condition is met (value not equal to 0), the value of the expression command is returned, otherwise the value of the expression alternative command is returned.

Note:

Simple IF-THEN-ELSE constructs can be mapped more easily with rules . Only if the expressions to be executed themselves contain multi-level commands, the use of a rule is not possible.

Example of changing the orientation of parts:

IF [Width]>[Length] AND [Grain]="NoGrain" THEN [Length] ELSE [Width]

Beispiel: Formel zur Änderung der Teileausrichtung

Example: Part Orientation Change Formula

Example additional notes depending on the material properties:

IF ([Thickness] <= 16 AND LEFT([Material]; 2) = "P2" AND [length]>800) THEN "Additional bottom support" ELSE ""

Beispiel: Formel für zusätzliche Notizen abhängig von den Materialeigenschaften

Example: Formula for additional notes depending on material properties

Example path to setting up the scanner on the CNC machine:

IF [CNC Program 1] <> "" THEN "\\HOMAG\CENTATEQ\"&[CNC Program 1] ELSE ""

Beispiel: Formel zur Pfadbestimmung

Example: Path Determination Formula

The SWITCH-CASE-DEFAULT construct

The SWITCH-CASE-DEFAULT construct makes it possible to compare a value with several possible cases and execute different statements depending on them. With multiple comparison options, this construct is clearer than multiple nested IF-THEN-ELSE queries.

SWITCH Reference
    CASE ComparisonXTHENCommandX
    CASE ComparisonA CASE ComparisonBTHENCommandA
DEFAULT Otherwise

The construct compares the value of the selected Reference column in sequence with all specified comparison values. If a match is found, the appropriate action is taken. This allows you to easily compare the same value with multiple cases without having to specify it multiple times.

If the parameter reference is to be compared with an entire range of values, the keyword CASE can be followed by intervals. An interval is specified as {beginning... End}.

Note:

The types, e.g. number or string of the reference values, must be identical to that of the reference value, while the types of the return values can be chosen arbitrarily. A reference of the type string can therefore only be compared with other strings and not with numbers.

Example label layout:

SWITCH [Customer name]
    CASE "Müller" THEN "Etikett_Müller"
    CASE "Meier" THEN "Etikett_Meier"
    CASE "Schneider" THEN "Etikett_Schneider"
DEFAULT "Standard label"

Beispiel: Formel zur Festlegung des Ettikettenlayouts

Example: Formula for defining the label layout

Example : Determination of the production path:

SWITCH [Article group]
   CASE "Lids" CASE "Shelves" CASE "Shelves" CASE "Shelves"
     THEN "SAWTEQ-EDGETEQ-DRILLTEQ-Montage"
   CASE "Back Panels"
     THEN "SAWTEQ Assembly"
    CASE "Fronts"
     THEN "SAWTEQ-EDGETEQ-CENTATEQ-Montage"
   CASE "Lacquer Fronts"
     THEN "SAWTEQ-EDGETEQ-DRILLTEQ-Surface-Assembly"
DEFAULT "SAWTEQ-EDGETEQ-DRILLTEQ-Montage"

Beispiel: Formel zur Festlegung des Fertigungswegs

Example: Formula to determine the manufacturing path

Note:

Conditional expressions can be nested and combined with each other as often as you like, subject to syntax rules. This means that, for example, an IF-THEN-ELSE construct may contain such a construct or logical operators.

Conversion and special functions

Function

Description

Example

STR(expression)

Converts the expression to a string.

STR(123) = "123"
STR(4+5) = "9"

VAL(expression)

Converts the result of the expression to a number. If it is a string that does not begin with digits, accidentals, or decimal separators, it returns 0.

Note:

The evaluation of the string is aborted as soon as an invalid character occurs.

VAL("123") = 123
VAL("-0.5") = -0.5
VAL("Text") = 0

VARDEF(variable name)

Verifies that the variable name is defined. If it is defined, 1 is returned, otherwise 0.

X=100
VARDEF("X") = 1
VARDEF("Y") = 0

STR() and VAL() accept both strings and numbers as parameters, so that the value of a variable that takes values of different types can be used with type safety.

Further technical explanations of how to create formulas are available for download at the top right of this page.


Resources

Further technical explanations