I have found some ArcObjects code to get unique values on one field for a IUniqueValueRenderer but I can't conceptually wrap my head around how to do that with 3 fields. Would this be .Net code or is there a property/method in the IUniqueValueRenderer?

My goal is to get a list of layer files with python (these layer files have symbology from a master symbology layer which generally has more unique value combinations than what the target layer file has..meaning that some of the values in the IUniqueValueRenderer needs to be removed with the RemoveValue) then call an this arcobjects exe that will, once passed the path to a layer, finds it's unique values (from 3 fields) then check the renderer and start to remove the ones that don't apply.


You are referring to ESRI.ArcGIS.Carto.IUniqueValueRenderer?

That interface includes a FieldCount property and Field that can be set with an index.

C# example...

pUniqueValueRenderer.FieldCount = 2;
pUniqueValueRenderer.set_Field(0, "Field 1");
pUniqueValueRenderer.set_Field(1, "Field 2");
pUniqueValueRenderer.FieldDelimiter = ",";

To loop each Field...

for (var i = 0; i < pUniqueValueRenderer.FieldCount; i++)
    string fieldName = pUniqueValueRenderer.get_Field(i);

ESRI Documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.