Apply to All
ApplyAllRule
⚠️ This rule is DEPRECATED. Please use the ApplyKitchenRule 🔗 instead. Its overload format is the same, however the new rule doesn't support the old format anymore (see below).
Parameter mapping for apply to all.
Notification level: Not applicable
Key | Value |
---|---|
ID | ApplyAllRule |
Translation key | Not applicable |
Behavior
This rule defines as many rules as needed of multiple parameters linked together by setting an array of style possible values. When "Apply To All" is requested on a parameter of furniture inside the overloads, the other parameters will be changed too in order to respect the mapping between the parameters.
Trigger Conditions
The rules is triggered on clicking the "Apply to all" button to modify the parameter of the furniture.
Overload Parameter
Key name | Type | Default value | Description |
---|---|---|---|
Can be everything | string | – | Mandatory The key here represents the name of the rule, like "rule01" for example. The value is an object that contains the name of parameters composed themselves by an array of the possible values. The possible value can be "null" or "empty". |
handleEmptyArrays | boolean | false | Optional Controls if the planner should display a user pop-in when encountering an empty array in the rule resolution. |
Old version (still supported)
In case of an overload describe belwo, if a user selects the front "13855" on a furniture and clicks the "Apply to all" button, every furniture that has a front will change its value to "13855" and every furniture that has the parameter drawerFront
will change its value to "13700".
{
"front": [
"13855", "15764", "15761", "13699", "14119", "15766", "15516", "15515", "15758"
],
"drawerFront": [
"13700", "15765", "15763", "15514", "14125", "15767", "15518", "15517", "15762"
]
}
New version
Here the overloads contain one rule that defines the mapping between the parameter front
and the parameter drawerFront
.
In case of an overload described above, if a user selects the front "13855" and clicks the "Apply to all" button, every furniture that has a front will change its value to "13855" or "13902" (it depends on the possible parameters of the furniture) and every furniture that has the parameter drawerFront
will change its value to "13700".
{
"rule01": {
"front": [
["13855", "13902"],
["13699", "16059"],
["15758", "16059"],
["14119"]
],
"drawerFront": [
["13700"],
["15514"],
["15762"],
["14125"]
]
}
}
It is possible to set a value to "null" or "empty".
Example – Possible value contains "null"
If the user selects "rightCoverPanel" = "15488"
and does apply to all, the backCoverPanel
will be instantiated as null, because "as null" is a possible value of this furniture. Therefore, the existing backCoverPanel
will be removed.
{
"rule03": {
"rightCoverPanel": [
["13857"],
["15528"],
["16053"],
["15488"]
],
"backCoverPanel": [
["13890"],
["15527"],
["16055"],
[null]
]
}
}
Example – Possible value contains "empty"
If the user selects "rightCoverPanel" = "13857"
, nothing will be changed for the backCoverPanel
because the corresponding value is empty. Therefore, the backCoverPanel
will remain in its state.
{
"rule03": {
"rightCoverPanel": [
["13857"],
["15528"],
["16053"],
["15488"]
],
"backCoverPanel": [
[],
["15527"],
["16055"],
[null]
]
}
}
More explanations about allowed cases
The Apply to All rule answers the following needs:
To be able to match different parameters all together or to have the different possible values for the same parameter: one element of the list manages the others.
Manage different types of fronts: drawer front, front, dishwasher front, blind front, glass front, etc.
Manage different types of cover panels: top cover panel, bottom cover panel, left cover panel, right cover panel, back cover panel, back left cover panel and back right cover panel.
And the complicated cases below:
- Box: The need could be to have several different IDs for the same style "black" for example.
- Shelves: The need could be to have several different IDs for a same style "glass" for example.
Case 1 – Multiple Values for the Same Parameter
Instead of setting only one possible value for a parameter, the Apply to All rule allows to set an array of values.
The code will search for an entry value and find the corresponding array, every single value of this array could be applicable for every furniture having this parameter as a possible value.
For example: The need is to manage black boxes with the Apply to All rule. The applicative rule defines the following array for the box:
[
black wall cabinet ID,
black base cabinet ID ,
black high cabinet ID
]
In the planner, if the customer edits the box option, selects the ID "black wall cabinet ID" for a wall cabinet and clicks Apply to All, the code will try to apply each value of this array to every cabinet that has the parameter "box" and the first matching with a possible values of the furniture will be applied.
In our example, for the base cabinet, the black base cabinet ID
is in the possible values of the parameter box
for this furniture, so this one will be applied.
Case 2 – Multiple Parameters Acting One From Another
If several parameters are present in the rule, an "Apply to All" of a value will trigger the application of the corresponding values (same index in the parameter array) to the other parameters.
Example
On the illustration above, the user is setting the drawerFront = red
with the Apply to All rule.
Because:
- "front", "glassFront" and "dishwasherFront" are part of the same "rule01"
- The index of "red" for "drawerFront" is [2]
...thus, the planner will try to apply the corresponding values [2], which is an array of values [ red 1, red 2 ], to the parameter "front" .
Same for "glassFront" with the values present for the index [2]: emptying it means that nothing will be done on this Apply to All (see the dedicated paragraph below on the page).
And same for "dishwasherFront".
📌 Following the same principle, this solution will be applied for other complicated cases mentioned above.
Prevent Breaking due to Change
When this color change will be delivered, the new and the old "Apply to All" rules will be active at the same time in order to avoid a "breaking" due to this change. Once the new rule is active on the Brand side and validated, the code referring to the old rule can be removed.
Rule Principles
In a more general way, you are able to add as many rules as wished following the principles below.
Number | Principle | Description |
---|---|---|
1 | Name | Each rule has a name, such as "rule01" and this name will not interfere in the management of the rule. |
2 | Array of arrays | Each rule has a list of as many parameters as needed. These parameters are made of an array of arrays of possible values (see above the complete sample). |
3 | Type 7 | The parameter could be any type 7, product 🔗 parameter exposed at the top-assembly level. Except linear parameters ( worktop , plinth , wallPanel , wallEdgeStrip , cornice , decoStrip ) because these linear parameters 🔗 are managed by the code and are too complex to be consider as simple reference value. |
4 | Index | When a parameter is triggered by an "Apply to all" action, the value "applied" will define the index in the "parameter" array by its availability in one array of possible values. The index represents a common "style" (e.g. a front in red or white), shared with every parameter of the rule. |
5 | Independence | Each rule is independent. There is no global style management between front / cover panel / frame / shelf etc. The user can for example set a white front with a red cover panel if the user wants. |
Behavior
Example:
front index [2]
For one array of possible values in one parameter index, the system will match the same index for the other parameters of the rule.
Therefore, for "dishwasherFront" the corresponding value will be the array of values present at the same index [2].
❗ If the value in the planner for this induced option is not null.
Null Values
The rule allows to set a value as 'null' and 'null' will be managed as a regular value.
Let us take this configuration as an example:
The user performs an "Apply to All" from the rightCoverPanel
, value grey cover panel
.
As a consequence, the backCoverPanel
will be instantiated as null, because null is a possible value of this backCoverPanel.
Empty Values
The rule allows to set a value as 'empty' (empty array) which means that no action will be triggered in the planner for this parameter.
Let us take this configuration as an example:
The user performs an "Apply to All" from the rightCoverPanel
value grey cover panel
.
As a consequence, because the corresponding value is empty, nothing will be changed in the global style for the backCoverPanel
if the user selects rightCoverPanel
= grey cover panel
.
The backCoverPanel will remain the white one if the white was present, red one if the red was present, etc.
Same Parameter Shared by many Rules
If a parameter is present in more than one rule, and the user is setting an Apply to all from this parameter, the system will trigger as many rules as the number of rules this parameter belongs to.
Induced Parameters and Null Values
Induced parameters present in the Apply to All rule are managed specifically.
Term | Definition |
---|---|
Induced parameter | Parameters updated in the global style are named "induced parameters" because they are present in the same rule as the parameter from which the apply action is made. |
The 'null' value is a way to manage the activation / deactivation of one product. Therefore, it should not be managed as other regular value, but in enabling / disabling context.
Example
This example will help giving important precisions regarding the management of 'null' values in the specific case of induced parameters.
Context: A customer clicks Apply to All for a cabinet on the scene to apply the color of the left cover panel to the top cover panel.
Behavior: If an induced parameter has a value set to 'null', the system will not apply the corresponding value of the Apply to All Rule because it will refuse to activate this option by setting a value on it.
Result: The "topCoverPanel" is null for one wall cabinet. If the user does an Apply all on the red leftCoverPanel, the ApplyAllRule defined a value of "red ID" for the topCoverPanel, but the existing value for the wall cabinet being "null" for this option and this parameter being an induced parameter, the 'null' value is not changed.
Impossible Apply to All Pop-In
When the customer triggers an "Apply to all", if the style cannot be applied on at least one parameter, a pop-in is displayed to her/him:
The display of this pop in can be triggered by two business cases:
- The apply to all could not be completed to every product
- There is an empty value
Case 1 – Apply to All not Completed
When the Apply to All is not being successful on every product on the scene, a pop-in is triggered.
There is no match between the style possible values defined in the ApplyAllRule mapping and the possible values of at least one parameter at the top-assembly level.
In details, the reason may be the following.
Reason | Description |
---|---|
Missing parameter | A parameter is missing in the ApplyAllRule. The planner will try to apply the defined value to all the products of the top-assembly that have this parameter at the first level. |
Mapping mismatch | The parameter is not missing in the ApplyAllRule. The planner will try to apply all the possible values present in the ApplyAllRule for this parameter and all the corresponding possible values present in the ApplyAllRule for the others parameters of the same rule, to all the parameters present at the first level of a top-assembly. |
Missing value(s) | The parameter is not missing and the mapping is correct. At least, for one parameter of one product on the scene: none of the values applied are present in the possible value for one top-assembly product parameter. |
Case 2 – Empty Value in the Apply to All Rule
If the parameter 'handleEmptyArrays' in the "ApplyAll" rule is present and the value is 'true', an empty value will trigger a pop-in with the message "The style has not been applied to all the parameters of the scene", if and only if there is at least one furniture on the scene that owns this parameter.
Let us take this configuration as an example:
If the user does an Apply to All from the parameter 'front' value 'red', as the corresponding value for the parameter 'glassFront' is empty, the pop-in will be launched only if:
- There is an entry 'handleEmptyArrays' with the value 'true' in the ApplyAllRule.
- And there at least one furniture with 'glassFront' is on the scene.
If this entry is not present in the ApplyAllRule, the default value is false, which means that an empty value will not launch the pop-in.
📌 The "Apply to selection" will not generate the pop-in as this pop-in is linked to the Apply to All method.
To illustrate this empty value in a json file, here is an example:
"rule01": {
"front": [
["1", "2"],
["3", "4", null],
["5"]
],
"drawerFront": [
["6"],
["7"],
["8"]
],
"glassFront": [
["9"],
["10"],
[]
]
}
In this example, if the user selects the dbID 5
from front
or the dbID 8
from drawerFront
, the ApplyAllRule will trigger the empty value for the glassFront
parameter.
Only an empty array will be considered as an empty value; an empty string, "null" value is seen from the code perspective as a regular value.
Apply to All Rule Inheritance Mechanism
This section details the behavior of the Apply of the global style default value at the insertion.
The principle of the inheritance, the overload with global style parameter:
For every parameter type Product in the TOP ASSEMBLY level, at the insertion, if a value or an array of values is present in the global style for one parameter: the planner will try to apply the value or all the values of the array present in the global style to the possible values of this parameter for this product: the first match between the global style values and possible values will be the value applied for this parameter.
If no match could be made, the parameter will take the default value set in the TOP ASSEMBLY level for this parameter.
With the fact that any "Apply" action will update the global style, as described above, it makes possible for the next cabinet to inherit the value of last setting done by the user (only valid if a match between the new global style defined and the possible values of the next cabinet is possible). Some precisions:
Insertion for the Linear Parameter
For the linear parameters: worktop, plinth, wallPanel, wallEdgeStrip, cornice, decoStrip, at the insertion, if the cabinet is inserted in an existing linear, the parameter will inherit the value of the existing linear. If the cabinet is inserted with no connection to an existing linear, this linear will inherit the value set in the global style.
In the following illustration, the worktop style in the global style is: "wood".
Illustration if the cabinet is inserted outside an existing linear:
Illustration if the cabinet is inserted on an existing linear:
Activated or Disabled by Default at Insertion for Linear Parameters
For all the linear parameters, especially cornice, decoStrip, wallPanel and wallEdgeStrip the activation or deactivation is not managed by the global style, but by a dedicated parameter, as in the table below:
Linear parameter | Dedicated parameter | Type no. | Type |
---|---|---|---|
cornice | corniceOption | 3 | boolean |
decoStrip | decoStripOption | 3 | boolean |
wallPanel | wallPanelOption | 3 | boolean |
wallEdgeStrip | wallEdgeStripOption | 3 | boolean |
So, for example, if an array of reference IDs is stored in the global style for the "cornice" or "decoStrip" (e.g. cornice and decoStrip grey), it does not mean that the next cabinet will come by default with "cornice" or "decoStirp", since only the parameters type 7 products are stored in the global style; the "corniceOption" or "decoStripOption" (type 3 boolean) is not managed in this global style list.
The fact that the "wallPanel", "wallEdgeStrip", "cornice" or "decoStrip" will come activated by default on the scene is manageable at the top-assembly level for a specific cabinet.
The illustration below shows a wall cabinet that is part of a wall linear with cornice activated. This wall cabinet will inherit the value "corniceOption" = true
.
The illustration below shows the case when a wall cabinet is inserted in the middle of the scene outside an existing wall linear.
Even if the corniceOption
has been activated with an Apply to All action before, the wall cabinet will come on the scene with the value of corniceOption
set to false
in the top-assembly.