Select to view content in your preferred language

Invalid Expression Error: No function was found with the name 'left'

125
3
a week ago
MackenzeOriger
Occasional Contributor

MackenzeOriger_0-1754525133262.png

I was doing a Field Calculation to remove the last 14 characters from every string in the field, and when I tried to verify the expression I got this error. Despite this, I was able to hit apply and the code worked as intended. Is this a bug, or is there something I'm not understanding here?

 

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

I don't use Arcade but

Text functions | ArcGIS Arcade | Esri Developer

has it being upper case which would be strange if arcade doesn't respect case.

Python slicing is an option (replace a and b with your field name enclosed in ! marks eg !name_field!

a = "abcdefghijklmnopqrstuvwxyz"
b = "abcde"

a[:14]
'abcdefghijklmn'

b[:14]
'abcde'

 


... sort of retired...
MackenzeOriger
Occasional Contributor

Thank you for your swift response! In the past i've not noticed any issues with case sensitivity in Arcade functions, but I realized after you had mentioned it that I had capitalized the Count function and not the Left function. Although it didn't seem to make a difference; I closed and reopened the project, rewrote the code exactly and it validated just fine. I think it must just be a bug...

MackenzeOriger_0-1754527379799.png

 

0 Kudos
Robert_LeClair
Esri Esteemed Contributor

I believe this arcade expression will work for you:

var txt = $feature.Label;
return Left(txt, Count(txt) - 14);

Replace the $feature.Label with $feature.Name - I believe it will work for you.