Implementing my own Expression Parser for the Labeling engine

592
1
Jump to solution
09-17-2012 01:25 PM
GeorgeFaraj
Occasional Contributor III
Hello, I'm trying to implement my own expression parser. Everything seems to be fine, but the IFeature that is passed to the FindLabel method of my parser does not contain values for fields. The get_Value method is always returning null. FindField returns a valid index. How can I tell the engine to populate its fields?


The following is my implementation of IAnnotationExpressionParser2.FindLabel:


  public string FindLabel(ESRI.ArcGIS.Geodatabase.IFeature feature, ILayerFields layerFields)   {    string label = "";    if (feature != null && layerFields != null)    {     int propIdIndex = layerFields.FindField("myfield");     if (propIdIndex >= 0)     {      var value = feature.get_Value(propIdIndex);      int propId;      if (value != null && int.TryParse(value.ToString(), out propId) && propId > 0)      {       label = "test " + propId.ToString();      }     }    }    return label;   }


Is there an option I have to set for this? Please let me know.

Thanks!
George Faraj
0 Kudos
1 Solution

Accepted Solutions
GeorgeFaraj
Occasional Contributor III
I will answer my own question here.

I needed to implement the get_Attribute method and AttributeCount property and return the name of the field I want retrieved in get_Attribute. This worked well.

View solution in original post

0 Kudos
1 Reply
GeorgeFaraj
Occasional Contributor III
I will answer my own question here.

I needed to implement the get_Attribute method and AttributeCount property and return the name of the field I want retrieved in get_Attribute. This worked well.
0 Kudos