Trying to create an attribute rule (immediate calculation rule) on a feature class within an Enterprise Geodatabase in Oracle (.sde) within ArcGIS Pro 2.9.5. I want to filter to improve performance. Specifically, selecting only records when the first five characters of the UNITID text field equal the WINDEX text field. I am starting with the following two lines of Arcade code in the Expression Builder and when I click the green Verify check mark, its says 'Expression is valid'.
var cur_unitid = Filter(FeatureSetByName($datastore, "WSL", ['UNITID'], false), 'Left(UNITID, 5) == $feature.WINDEX');
var cur_unitid_desc = OrderBy(cur_unitid, 'UNITID DESC');
However, when I add the following third line of code and click the green Verify check mark, it says 'Invalid expression. Error on line 3. Invalid where clause (Left(UNITID, 5) == $feature.WINDEX)'.
var cur_unitid_max = first(cur_unitid_desc);
Can the Left function be used on a feature class field name and/or is there an error in how I am using it?