Hi
Is it possible to make an expression in my Field maps formula, where the value of attribute1 (an integer) = 4 if the value of attribute2 (a string) is not null.
Regards Rasmus
Hi,
This is possible - it will require you to have an editability expression and a value expression on attribute1.
editability expression must return 'false' if you want the value to calculate, so it would look like:
if (IsEmpty($feature.attribute2)) { return true };
return false;
value expression just needs to handle the calculation: (this won't fire if editability = false)
if (!IsEmpty($feature.attribute2)) { return 4 };
Yes, you can do this with an Arcade expression in Field Maps.
Example:
if (!IsEmpty($feature.attribute2)) {
return 4;
} else {
return $feature.attribute1;
}
This sets attribute1 = 4 only when attribute2 is not null. Otherwise, it keeps the original value.
Thanks for the answers. I tried both solutions (replacing attribute1/2 with the actual field names of course) but I keep getting an error when i try to save stating that the formula is invalid.