Expression

From Opera Wiki

(Difference between revisions)
Jump to: navigation, search
(Created page with '= Espressioni / Expressions = {| class="wikitable" style="width:100%" ! style="width:50%" | Italiano ! style="width:50%" | English |- | '''Le espressioni''' consentono di defini…')
(Espressioni / Expressions)
Line 1: Line 1:
-
= Espressioni / Expressions =
+
= Expressions =
-
{| class="wikitable" style="width:100%"
+
'''Expressions''' allow the definition of complex rules for verifying conditions in autoselections or for defining dimension values of profiles or accessories.   
-
! style="width:50%" | Italiano
+
-
! style="width:50%" | English
+
-
|-
+
-
| '''Le espressioni''' consentono di definire regole complesse per la verifica delle condizioni nelle autoselezioni oppure per la definizione di valori di quota di profili o accessori. 
+
-
Un’espressione può contenere ''numeri'', [[variabili]], ''operatori matematici/logici'', ''funzioni matematiche'' e ''funzioni speciali'', che vengono valutati per stabilire se una condizione è vera o falsa. 
+
-
| '''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.   
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.   
-
|-
+
 
-
| Gli operatori matematici disponibili sono: 
+
The available mathematical operators are:
-
* <code>+ - * /</code> → rispettivamente addizione, sottrazione, moltiplicazione e divisione 
+
* <code>+ - * / </code> → respectively addition, subtraction, multiplication and division
-
* <code>></code> → maggiore 
+
* <code>></code> → greater than
-
* <code><</code> → minore 
+
* <code><</code> → less than
-
| The available mathematical operators are:
+
 
-
* <code>+ - * /</code> → respectively addition, subtraction, multiplication and division
+
The available mathematical functions are:
-
* <code>></code> → greater than
+
* <code>round(x)</code> → returns the integer closest to X
-
* <code><</code> → less than
+
* <code>floor(x)</code> → returns the greatest integer less than or equal to X
-
|-
+
* <code>ceil(x)</code> → returns the smallest integer greater than or equal to X
-
| Le funzioni matematiche disponibili sono: 
+
* <code>sqr(x)</code> → returns the square root of X
-
* <code>round(x)</code> → restituisce il numero intero più vicino a X 
+
* <code>log(x)</code> → returns the natural logarithm of X
-
* <code>floor(x)</code> → restituisce il numero intero minore o uguale a X 
+
* <code>exp(x)</code> → returns the result of e^<sup>x</sup>
-
* <code>ceil(x)</code> → restituisce il numero intero maggiore o uguale a X 
+
* <code>cos(x) | sin(x)</code> → returns the cosine and sine of X, respectively
-
* <code>sqr(x)</code> → restituisce la radice quadrata di X 
+
* <code>acos(x) | asin(x)</code> → returns the arccosine and arcsine of X, respectively
-
* <code>log(x)</code> → restituisce il logaritmo naturale di X 
+
 
-
* <code>exp(x)</code> → restituisce il risultato di e^<sup>x</sup> 
+
 
-
* <code>cos(x) | sin(x)</code> → restituisce rispettivamente il coseno e il seno di X 
+
== Concatenation of elements ==
-
* <code>acos(x) | asin(x)</code> → restituisce rispettivamente l'arcocoseno e l'arcoseno di X 
+
Elements can be combined together by:
-
| The available mathematical functions are:
+
* using nested functions;
-
* <code>round(x)</code> → returns the integer closest to X
+
* using logical operators to join multiple conditions separated by parentheses.
-
* <code>floor(x)</code> → returns the greatest integer less than or equal to X
+
 
-
* <code>ceil(x)</code> → returns the smallest integer greater than or equal to X
+
Logical operators are:
-
* <code>sqr(x)</code> → returns the square root of X
+
* <code>&</code> → logical AND (both conditions must be true);  
-
* <code>log(x)</code> → returns the natural logarithm of X
+
* <code>|</code> → logical OR (at least one condition must be true).  
-
* <code>exp(x)</code> → returns the result of e^<sup>x</sup>
+
 
-
* <code>cos(x) | sin(x)</code> → returns the cosine and sine of X, respectively
+
 
-
* <code>acos(x) | asin(x)</code> → returns the arccosine and arcsine of X, respectively
+
{{BR}}
-
|-
+
{{ES|  
-
| == Concatenazione degli elementi == 
+
<pre>profile(A1010) & option(OPZ1) → true only if the profile is 'A1010' AND the option 'OPZ1' is active</pre>  
-
Gli elementi possono essere combinati tra loro tramite: 
+
<pre>(Lia>500) & (Hia>1600) → true only if the sash width is greater than 500mm and the sash height is greater than 1600mm</pre>  
-
* l’uso di funzioni nidificate; 
+
}}
-
* l’uso di operatori logici per unire più condizioni separate da parentesi tonde. 
+
 
-
| == Concatenation of elements ==
+
{{BR}}
-
Elements can be combined together by:
+
 
-
* using nested functions;
+
== Special functions ==
-
* using logical operators to join multiple conditions separated by parentheses.
+
Several ''special functions'' are available, useful for checking the presence or status of profiles, accessories and options within the structure:
-
|-
+
 
-
| Gli operatori logici sono: 
+
* <code>profile(...)</code>: checks if the condition is evaluated in a specific profile.  
-
* <code>&</code> → AND logico (entrambe le condizioni devono essere vere) 
+
* <code>typology-option(...)</code>: checks if an option is active in any structure of the typology. 
-
* <code>|</code> → OR logico (almeno una condizione deve essere vera) 
+
* <code>option(...)</code>: checks if an option is active in the current structure. 
-
| Logical operators are:
+
* <code>frameside-contains(...)</code>: checks if a profile/accessory is present in one side of the frame or sash. 
-
* <code>&</code> → logical AND (both conditions must be true)   
+
* <code>frame-contains(...)</code>: checks the presence of a profile/accessory in the frame or sash (any side). 
-
* <code>|</code> → logical OR (at least one condition must be true)   
+
* <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. 
-
| {{ES|
+
* <code>typology-contains(...)</code>: extended search on all structures of the typology. 
-
<pre>profile(A1010) & option(OPZ1) → vero solo se il profilo è 'A1010' E l’opzione 'OPZ1' è attiva</pre>
+
* <code>fix-contains(...)</code>: checks in the profiles of the current frame. 
-
<pre>(Lia>500) & (Hia>1600) → vero solo se la larghezza dell'anta è maggiore di 500mm e l'altezza dell'anta è maggiore di 1600mm</pre>
+
* <code>sash-contains(...)</code>: checks in the profiles of the current sash. 
-
}}   
+
 
-
| {{ES|
+
For searches inside panes, the following functions are available:
-
<pre>profile(A1010) & option(OPZ1) → true only if the profile is 'A1010' AND the option 'OPZ1' is active</pre>
+
* <code>sash-panes-contains(...)</code>: checks in the filling of the current sash. 
-
<pre>(Lia>500) & (Hia>1600) → true only if the sash width is greater than 500mm and the sash height is greater than 1600mm</pre>
+
* <code>struct-panes-contains(...)</code>: checks in all fillings of the structure. 
-
}}
+
 
-
|-
+
 
-
| == Funzioni speciali ==   
+
{{BR}}
-
… [continua con la stessa struttura affiancata IT/EN per ogni sezione]  
+
{{ES|  
-
| == Special functions == 
+
<pre>profile(PROFILE_NAME)</pre> 
-
… [continue with the same side-by-side IT/EN structure for each section]  
+
<pre>struct-contains(PROFILE_OR_ACCESSORY_NAME)</pre> 
-
|}
+
<pre>option(OPTION_NAME)</pre>
 +
<pre>struct-contains(ACC123) | struct-contains(ACC456) → true if the structure contains the accessory 'ACC123' or 'ACC456'.</pre>
 +
<pre>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'</pre>
 +
}}
 +
 
 +
{{BR}}
 +
 
 +
== 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:
 +
 
 +
* <code>regular expression</code>: if the parameter starts with <code>r=</code>, it is interpreted as a ''regexp''.  
 +
* <code>keyword</code>: if the parameter is <code>keyword(key)</code>, the keyword ''key'' is searched in the key fields of profiles, accessories or options.  
 +
 
 +
{{BR}}
 +
{{ES|
 +
<pre>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.</pre>
 +
<pre>frameside-contains(keyword(KITAR)) → checks if, in the current side, the frame or its accessories have the keyword 'KITAR'.</pre>
 +
}}
 +
 
 +
Regular expression and keyword searches can also be ''nested''.  
 +
{{ES|
 +
<pre>typology-contains(keyword(r=^FR)) → searches throughout the typology for profiles or accessories where at least one keyword starts with 'FR'.</pre>}}

Revision as of 07:46, 27 August 2025

Contents

Expressions

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).



Note ES:
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 the frame or 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.



Note ES:
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 with r=, it is interpreted as a regexp.
  • keyword: if the parameter is keyword(key), the keyword key is searched in the key fields of profiles, accessories or options.


Note ES:
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.

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