Hello, I am trying to write a rule that will prevent the deletion of features in an fc. I'm getting the error 'Invalid expression. Close parenthesis expected' but I don't know why. Here is what I have so far.
var currentAssetId = $feature.cab_id
var fsMyClass = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries_copy")
var fsResult = filter(fsMyClass, "cab_id = @currentAssetId")
if (first(fsResult) IN $originalfeature.cab_id)
return true;
else
return false;
I believe the problem is in the if statement but I don't know what would be wrong here.
Solved! Go to Solution.
The if statement is an invalid syntax. You are comparing a feature (first(fsResult)) to a value $originalfeature.cab_id. Plus don't use IN, use == instead and compare the actual values
That being said, I'm not sure what the rule is trying to do, maybe provide a brief description of what the rule is suppose to do? Going by your statement if you want to prevent deletion of features it is a matter of simply creating a constraint rule that returns false.
return false;
Just a shot in the dark, but don't you need to enclose things in curly braces?
if (first(fsResult) IN $originalfeature.cab_id){
return true;
}else{
return false;
}
I tried this while troubleshooting before posting, but unfortunately this doesn't clear the error. Thanks for taking a look.
Rats...
The if statement is an invalid syntax. You are comparing a feature (first(fsResult)) to a value $originalfeature.cab_id. Plus don't use IN, use == instead and compare the actual values
That being said, I'm not sure what the rule is trying to do, maybe provide a brief description of what the rule is suppose to do? Going by your statement if you want to prevent deletion of features it is a matter of simply creating a constraint rule that returns false.
return false;
Good catch...
Wow so simple, that's great. Thanks again!