Select to view content in your preferred language

the mechanism of arcade Attribute Validation

41
0
yesterday
yockee
by
Frequent Contributor

I have Attribute Validation created in Arcgis Pro. This validation is used to check a coloumn uniqueness. The Feature Class is then published to be consumed by Field Map apps via Feature Service. This is the code :

var id = $feature.code_oid;

if (id == null || id == "") {
return true;
}

var fs = FeatureSetByName(
$datastore,
"db1.schema1.FC1",
["code_oid", "objectid"],
false
);

var oid_self = $feature.objectid;

var others = Filter(fs, "code_oid = @ID AND objectid <> @oid_self");

if (Count(others) > 0) {
return {
"errorMessage": "code_oid already existed."
};
}

return true;

The validation works eventhough it is accessed via Field Map. I am wondering :

1. How can this Attribute Validation be accessed via Field Map ? Where is it actually stored ? 

2. "var others = Filter(fs, "code_oid = @ID AND objectid <> @oid_self");"

a. can this part be changed to other logic ? More like code refactoring. I am thinking of using a Postgres-like function like "EXISTS" to avoid scanning all rows.

b. Can the fields involved in the Filter here (code_oid and objectid) be indexed ? How to index them if they are stored in Datastore? 

3. "var fs = FeatureSetByName($datastore,"db1.schema1.FC1",["code_oid", "objectid"],false);"

a. Does this mean that the data are stored in the Datastore ? If yes, it will mean that its space will increase as the amount of data increasing. Where to check the physical location of Datastore ?

b. Does $datastore acts as pointer to database or it acts as storage of the table itself (ie: the data are copied from database into Arcgis Server) ?

Thanks

0 Kudos
0 Replies