rougail/doc/condition/redefine.md

59 lines
1 KiB
Markdown
Raw Normal View History

2021-02-15 18:52:41 +01:00
# Rédéfinition
Il se peut que dans un dictionnaire on décide de définir une condition.
Dans un second dictionnaire il est possible de supprimer cette condition.
Dans un premier dictionnaire déclarons notre variable et notre calcule :
2022-11-03 22:17:43 +01:00
```xml
2021-02-15 18:52:41 +01:00
<variables>
2021-12-11 16:33:55 +01:00
<variable name="condition" type="boolean"/>
<variable name="my_variable"/>
2021-02-15 18:52:41 +01:00
</variables>
<constraints>
2021-12-11 16:33:55 +01:00
<condition name="hidden_if_in" source="condition">
<param>True</param>
<target>my_variable</target>
</condition>
2021-02-15 18:52:41 +01:00
</constraints>
```
2022-11-02 22:52:50 +01:00
En YAML :
2022-11-03 22:17:43 +01:00
```yml
2022-11-02 22:52:50 +01:00
variables:
- variable:
name: condition
type: boolean
- variable:
name: my_variable
constraints:
- condition:
- name: hidden_if_in
source: condition
param:
2022-11-03 22:16:52 +01:00
- text: true
2022-11-02 22:52:50 +01:00
target:
- text: my_variable
```
2021-02-15 18:52:41 +01:00
Dans un second dictionnaire supprimer ce calcul :
2022-11-03 22:17:43 +01:00
```xml
2021-02-15 18:52:41 +01:00
<variables>
2021-12-11 16:33:55 +01:00
<variable name="condition" redefine="True" remove_condition="True"/>
2021-02-15 18:52:41 +01:00
</variables>
```
2022-11-02 22:52:50 +01:00
En YAML :
2022-11-03 22:17:43 +01:00
```yml
2022-11-02 22:52:50 +01:00
variables:
- variable:
name: condition
2022-11-03 22:16:52 +01:00
redefine: true
remove_condition: true
2022-11-02 22:52:50 +01:00
```