Hi,
I'm new to arcade and trying write a simple expression to put logic requirement in a field.
I have three string fields (field1, field2, field3) with domains values (value1, value2).
If in field1 and field2 a specific values and their combination are chosen, field3 must NOT be required for filling if at least one condition match.
I tried but it does not work. Please advise what's incorrect
DomainName($feature,"Field1")!="Value1"||
DomainName($feature,"Field1")!="Value2"||
DomainName($feature,"Field1")!="Value3"&& DomainName($feature,"Field2")!="Value1"
Solved! Go to Solution.
If(DomainName($feature, "Lithology") == "Tuff"){
return false;
}
else if(DomainName($feature, "Lithology") == "Silica Rock" && DomainName($feature, "Protolithology") == "Tuff"){
return false;
}
else if(!IsEmpty($feature["Lithology"])){
return true;
}
else {
return false;
}
Good morning,
One suggestion I have for you is flipping your expression to the positive, meaning you will want to give the case(s) for when the field should show as required, instead of when it's not required. And when you do that you will want to use == when setting the fields equal, for example -
DomainName($feature, "Modify_Date") == "Yes"
It's much easier to work in the positive with Arcade.
Kerri
Another option that works as well is using contingent values. This will automatically limit values based on inputs of other values.
The phrase "at least one" sounds like the function Any. Put your conditions in an array, then use Any to return a true/false value if anything comes back.
Any([
DomainName($feature,"Field1") != "Value1",
DomainName($feature,"Field1") != "Value2",
DomainName($feature,"Field1") != "Value3" && DomainName($feature,"Field2") != "Value1"
])
The Includes function or a for loop I believe could also work as well. Plenty of options for achieving similar results.
There is an error:
Test execution error: Execution error - Call with wrong number of parameters. Verify test data.
Good morning. Would you mind sharing your Arcade Expression? It's easier to troubleshoot that way.
Good day,
Apologies for delaying with response.
There are three fields:
Lithology Texture field required when:
Lithology Texture field NOT required when:
My expression:
1 DomainName($feature,"Lith")!=null||
2 DomainName($feature,"Lith")!="Tuff"||
3 DomainName($feature,"Lith")!="Silica rock"&& DomainName($feature,"Protolith")!="Tuff"
It works with first line only.
Two others are not working i.e. Lithology Texture field with asterix (still required)
P.S. Expression
If(DomainName($feature, "Lithology") == "Tuff"){
return false;
}
else if(DomainName($feature, "Lithology") == "Silica Rock" && DomainName($feature, "Protolithology") == "Tuff"){
return false;
}
else if(!IsEmpty($feature["Lithology"])){
return true;
}
else {
return false;
}
Thanks @KerriRasmussen !