Esri / arcade-expressions

ArcGIS Arcade expression templates for all supported profiles in the ArcGIS platform.
Apache License 2.0
278 stars 99 forks source link

Constraint: Constrain input to domain #19

Closed steveoh closed 5 years ago

steveoh commented 5 years ago

๐Ÿš€๐Ÿš€

I should also note that with python and string formatting, you can make this rule very generic...

constain_to_domain = '''if (!haskey($feature, '{0}') || isempty($feature.{0})) {{
    return true;
}}

return iif (isempty(domainname($feature, '{0}', $feature.{0})), {{
    'errorMessage': 'Value does not fall within the allowable domain values. Input: ' + $feature.{0}
}}, true);'''
steveoh commented 5 years ago

No I havenโ€™t reported it but I think itโ€™s pretty well known.