Hello, I have 2 classes, one called fibercable, and another one called Splice points. I am trying to create a rule for when a splice point intersects a fibercable at any point, it will get the value in the 'placement' row of the fibercable's attribute table where it intersects the new splice point, then it will apply it to the 'placement' row of the new splice point that has just been created. My code is below and it keeps giving an 'Indexable type expected' error. How would this potentially work? Thanks!
var fibercable = FeaturesetbyName($datastore, 'attributeruletest.sde.fibercable');
var ints = Intersects(fibercable, Geometry($feature));
iif(Count(ints) > 0, ints['placement'], false);
The Intersects function returns a FeatureSet, not a feature, so you'll have to extract a feature from "ints". If you know there will only be one feature in that FeatureSet, then you can use the First function.
iif(Count(ints) > 0, First(ints)['placement'], false);
Otherwise, you'd have to loop through the FeatureSet to get each feature..
Hi @rsnider43,
So the issue with your code is that you are trying to access a featureset, not a feature. Just modify the code sto the following below.
var fibercable = FeaturesetbyName($datastore, 'attributeruletest.sde.fibercable');
var ints = Intersects(fibercable, Geometry($feature));
iif(Count(ints) > 0, First(ints)['placement'], false);
// Option 2
var fibercable = FeaturesetbyName($datastore, 'attributeruletest.sde.fibercable')
var ints = First(Intersects(fibercable, Geometry($feature)))
iif(TypeOf(ints) == 'Feature', ints['placement'], false)
When you use intersect function it returns a 'FeatureSet' which is multiple records whereas the 'First' function returns a single record, or 'Feature'.