I am trying to filter the database by using profile variable $Map in ArcGIS Pro Attribute Rules and I had an Object Not Found Error
var deviceClass = FeatureSetByName($map, "Communications Device");
Another Question :
I always do this kind of filter using profile variable $datastore. I want only to get the field room from this table, but when printing the results all fields are there
var test="{4EC98101-67C4-44FC-8BF5-C7DF9393AB73}"
var deviceClass = FeatureSetByName($datastore, "CommunicationsJunctionObject");
var devicesRows = Filter(deviceClass, "GLOBALID = @test");
return{"errorMessage":"FeatureSetByAssociation: "+first(devicesRows)};
this screen of the output
var test="{4EC98101-67C4-44FC-8BF5-C7DF9393AB73}"
var deviceClass = FeatureSetByName($datastore, "CommunicationsJunctionObject",['room'],false);
var devicesRows = Filter(deviceClass, "GLOBALID = @test");
return{"errorMessage":"FeatureSetByAssociation: "+first(devicesRows)};
the second output
Solved! Go to Solution.
To post code:
I am trying to filter the database by using profile variable $Map in ArcGIS Pro Attribute Rules
You can't use $map in attribute rules. Attribute rules work on the database level and can be triggered from different maps (or even without a map at all), so it doesn't make sense to rely on a featureset in a specific map.
Instead, use $datastore if the featureset is in the same database. If not, you have to publish it and load it in using FeaturesetByPortalItem().
I want only to get the field room from this table, but when printing the results all fields are there
You return the whole feature, so every field is printed. Instead, return only a specific field:
var test="{4EC98101-67C4-44FC-8BF5-C7DF9393AB73}"
var deviceClass = FeatureSetByName($datastore, "CommunicationsJunctionObject");
var devicesRows = Filter(deviceClass, "GLOBALID = @test");
var device = First(devicesRows)
var room = IIf(device == null, "nodevice found", device.room)
return{"errorMessage":"FeatureSetByAssociation: " + room};
Ah, I see now that I misunderstood your second question.
I see this behavior in a file gdb. While the Console() command ouputs the right message (empty geometry and only one field [plut OBJECTID]), the error message prints the complete feature, although I didn't load the geometry and the other fields.
var fs = FeatureSetByName($datastore, "TestLines", ["IntegerField"], false);
Console(First(fs))
return {errorMessage: Text(First(fs))}
In an Enterprise GDB, it works as expected:
var fs = FeatureSetByName($datastore, "Bauwerke", ["BauwerkID"], false);
Console(First(fs))
return {errorMessage: Text(First(fs))}
@HusseinNasser2 , any insights?
To post code:
I am trying to filter the database by using profile variable $Map in ArcGIS Pro Attribute Rules
You can't use $map in attribute rules. Attribute rules work on the database level and can be triggered from different maps (or even without a map at all), so it doesn't make sense to rely on a featureset in a specific map.
Instead, use $datastore if the featureset is in the same database. If not, you have to publish it and load it in using FeaturesetByPortalItem().
I want only to get the field room from this table, but when printing the results all fields are there
You return the whole feature, so every field is printed. Instead, return only a specific field:
var test="{4EC98101-67C4-44FC-8BF5-C7DF9393AB73}"
var deviceClass = FeatureSetByName($datastore, "CommunicationsJunctionObject");
var devicesRows = Filter(deviceClass, "GLOBALID = @test");
var device = First(devicesRows)
var room = IIf(device == null, "nodevice found", device.room)
return{"errorMessage":"FeatureSetByAssociation: " + room};
Hi Johannes,
Thanks for your attention and your fast reply.
Regarding my second question, I know how to print a specific field from the feature my question was about, I had read in the documentation that specifying specific fields to feature class or table is making performance faster, so I thought the object returned from this line should only contain room field.
var deviceClass = FeatureSetByName($datastore, "CommunicationsJunctionObject",['room'],false);
Ah, I see now that I misunderstood your second question.
I see this behavior in a file gdb. While the Console() command ouputs the right message (empty geometry and only one field [plut OBJECTID]), the error message prints the complete feature, although I didn't load the geometry and the other fields.
var fs = FeatureSetByName($datastore, "TestLines", ["IntegerField"], false);
Console(First(fs))
return {errorMessage: Text(First(fs))}
In an Enterprise GDB, it works as expected:
var fs = FeatureSetByName($datastore, "Bauwerke", ["BauwerkID"], false);
Console(First(fs))
return {errorMessage: Text(First(fs))}
@HusseinNasser2 , any insights?
Thanks, Johannes it was a fruitful discussion.
@JohannesLindner Can you try the filegdb case with Pro 3.1 Beta if you have access?
We have a known issue where Arcade might sometime fetch all the fields even a subset is provided.
Unfortunately, I don't have access to Pro 3.1 Beta version.
No worries, I confirmed this is fixed in Pro 3.1.
@HusseinNasser2 I don't have access to the beta. The example above was done in 3.0.3
We have been able to use the $map to do the following in AGOL, but our need is for auto-filling certain attributes in Pro as well as in AGOL. Can you use that FeaturesetByPortalItem() variable to connect to other FCs in other databases on your Portal for use in Intersect and Nearest Neighbor Attribute rules for use in Pro?