Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
bonjour,
comment faire pour que cette condition fonctionne if ([machine]='70443''40195''40202','VOP PANTHER USI PREPA COUV')as Secteur.
si je met qu'un numéro ça fonctionne if ([machine]='70443','VOP PANTHER USI PREPA COUV')as Secteur
merci
if ([machine]='70443' or [machine]='40195' or [machine]='40202',
'VOP PANTHER USI PREPA COUV')as Secteur.
Hello,
There is an official documentation [1] for the If() function. This function has only 3 parameters which are separated with ",". The Syntax of the function is the following one: if(condition , then [, else])
This first part is the condition
The second part is what needs to be done if the condition is True
The last part is what needs to be done if the condition is False
Additionally it is stated that the last parameter is optional and if it is not provided, then it will be NULL.
In your use case scenario the expression "if ([machine]='70443','VOP PANTHER USI PREPA COUV')as Secteur" is working, because:
The other expression: "if ([machine]='70443''40195''40202','VOP PANTHER USI PREPA COUV')as Secteur" it is not working, because there are multiple separate values in the condition.
To resolve this issue, you will have to use the following expression:
if (
[machine]='70443',
'VOP PANTHER USI PREPA COUV',
if (
[machine]='40195',
'VOP PANTHER USI PREPA COUV',
if (
[machine]='40202',
'VOP PANTHER USI PREPA COUV',
Null()
)
)
)as Secteur
This expression first checks if the value is '70443' and then assigns 'VOP PANTHER USI PREPA COUV'. If the value is not '70443', then the last part of the first if statement is evaluated. Here we do the same check for the next value '40195' and we repeat the process until we reach to the last value. If none of the 3 values matches the values that we have specified, then it will assign the NULL.
Here is the expression breakdown:
Please keep in mind that there might be other ways to implement the same outcome, however this is the one that I have tested that is working for now.
I hope that this information was helpful. If your issue was resolved, please mark it as solution to give further visibility to the topic for the other community members. Otherwise, if I have misunderstood the use case scenario, please elaborated in detail by providing additional information.
---
if ([machine]='70443' or [machine]='40195' or [machine]='40202',
'VOP PANTHER USI PREPA COUV')as Secteur.
Thank you