Expression
From Opera Wiki
(→Special functions) |
|||
Line 46: | Line 46: | ||
* <code>option(...)</code>: checks if an option is active in the current structure. | * <code>option(...)</code>: checks if an option is active in the current structure. | ||
* <code>frameside-contains(...)</code>: checks if a profile/accessory is present in one side of the frame or sash. | * <code>frameside-contains(...)</code>: checks if a profile/accessory is present in one side of the frame or sash. | ||
- | * <code>frame-contains(...)</code>: checks the presence of a profile/accessory in | + | * <code>frame-contains(...)</code>: checks the presence of a profile/accessory in current frame/sash (any side). |
* <code>sideX-contains(...)</code>: same as above, but referring to a specific side (insert value instead of X: 1 = left, 2 = right, 3 = top, 4 = bottom). | * <code>sideX-contains(...)</code>: same as above, but referring to a specific side (insert value instead of X: 1 = left, 2 = right, 3 = top, 4 = bottom). | ||
* <code>struct-contains(...)</code>: checks in the current structure. | * <code>struct-contains(...)</code>: checks in the current structure. |
Revision as of 08:06, 27 August 2025
Contents |
Overview
Expressions allow the definition of complex rules for verifying conditions in autoselections or for defining dimension values of profiles or accessories. An expression may contain numbers, variables, mathematical/logical operators, mathematical functions and special functions, which are evaluated to determine whether a condition is true or false.
The available mathematical operators are:
-
+ - * /
→ respectively addition, subtraction, multiplication and division -
>
→ greater than -
<
→ less than
The available mathematical functions are:
-
round(x)
→ returns the integer closest to X -
floor(x)
→ returns the greatest integer less than or equal to X -
ceil(x)
→ returns the smallest integer greater than or equal to X -
sqr(x)
→ returns the square root of X -
log(x)
→ returns the natural logarithm of X -
exp(x)
→ returns the result of e^x -
cos(x) | sin(x)
→ returns the cosine and sine of X, respectively -
acos(x) | asin(x)
→ returns the arccosine and arcsine of X, respectively
Concatenation of elements
Elements can be combined together by:
- using nested functions;
- using logical operators to join multiple conditions separated by parentheses.
Logical operators are:
-
&
→ logical AND (both conditions must be true); -
|
→ logical OR (at least one condition must be true).

profile(A1010) & option(OPZ1) → true only if the profile is 'A1010' AND the option 'OPZ1' is active
(Lia>500) & (Hia>1600) → true only if the sash width is greater than 500mm and the sash height is greater than 1600mm
Special functions
Several special functions are available, useful for checking the presence or status of profiles, accessories and options within the structure:
-
profile(...)
: checks if the condition is evaluated in a specific profile. -
typology-option(...)
: checks if an option is active in any structure of the typology. -
option(...)
: checks if an option is active in the current structure. -
frameside-contains(...)
: checks if a profile/accessory is present in one side of the frame or sash. -
frame-contains(...)
: checks the presence of a profile/accessory in current frame/sash (any side). -
sideX-contains(...)
: same as above, but referring to a specific side (insert value instead of X: 1 = left, 2 = right, 3 = top, 4 = bottom). -
struct-contains(...)
: checks in the current structure. -
typology-contains(...)
: extended search on all structures of the typology. -
fix-contains(...)
: checks in the profiles of the current frame. -
sash-contains(...)
: checks in the profiles of the current sash.
For searches inside panes, the following functions are available:
-
sash-panes-contains(...)
: checks in the filling of the current sash. -
struct-panes-contains(...)
: checks in all fillings of the structure.

profile(PROFILE_NAME)
struct-contains(PROFILE_OR_ACCESSORY_NAME)
option(OPTION_NAME)
struct-contains(ACC123) | struct-contains(ACC456) → true if the structure contains the accessory 'ACC123' or 'ACC456'.
option(OPZ1) & (side-contains(PF100) | side-contains(PF200)) → option 'OPZ1' must be active and, at the same time, the side must contain 'PF100' or 'PF200'
Advanced code search
Expressions support two types of advanced search, useful when a condition should not apply to a single profile but to all profiles with a certain name (or part of a name) or a certain keyword:
-
regular expression
: if the parameter starts withr=
, it is interpreted as a regexp. -
keyword
: if the parameter iskeyword(key)
, the keyword key is searched in the key fields of profiles, accessories or options.

side-contains(r=P.*2) → searches for a profile/accessory in the current side whose name contains the letter 'P' followed by the number '2', with any characters in between.
frameside-contains(keyword(KITAR)) → checks if, in the current side, the frame or its accessories have the keyword 'KITAR'.
Regular expression and keyword searches can also be nested.

typology-contains(keyword(r=^FR)) → searches throughout the typology for profiles or accessories where at least one keyword starts with 'FR'.