Parse a featureLayer label expression

758
1
03-23-2017 09:17 AM
by Anonymous User
Not applicable

I need to parse a string out of a featurelayer field to create a label, can anyone point me to a solution. The labelExpressionInfo looks like the following;

var HYjson = {                    

labelExpressionInfo:{                    

   expression: "$feature.link"                                          

 }                      

};

what I need to do would be something that accomplishes what would be a substr(-5) on the expression.

0 Kudos
1 Reply
thejuskambi
Occasional Contributor III

For Label Expressions, you can use the Arcade format. In Arcade to get a part of the string we use below expression.

var expression = "mid($feature.LABELFIELD, 2, 3)";

here you get the characters from 3 to 5.

This link is not for JS api but, contains lot of tip on how to use Arcade.Specify text for labels—ArcGIS Pro | ArcGIS Desktop 

0 Kudos