The question has 2 parts: In ArcGIS Pro, If you import symbology from a layer that has labeling activated, the labeling gets imported as well. I have not found an option to define a new labeling field. I use the value field for defining the field for the symbology (side question: why do I need to define the original field manually? this should be part of the layer definition and can be difficult to remember.) Is there a similar way to define the label field name or not to import the labeling?
In my current project, after importing the symbology, the labeling expression contains a field that does not exist. When I try to set it to an existing field (by double clicking on the fieldname in the field list) I get the error "Invalid Expression. No features found.". I am stuck there, no matter if I apply, cancel, deactivate-reactivate labeling. Any ideas? my own workaround will be, to open the lyr-file in an editor and try to change the labeling field manually.
The manuel editing of the lyrx file did not help. Now an existing column name is pre-selected, but no labels showing. the symbology shows as expected. If I change the labeling to another column name from the list, I get the same error as in the original post. When I apply labels before importing the symbology, everything works.
I was able to delete the LabelCLasses and labelVisibility from the lyrx file, then import symbology and only the symbology came across with no labeling or label issues.
Was also able to edit the lyrx file and change the LabelClasses expression to use a different column for labeling, then import and updates symbology and modified label column.
"labelClasses" : [
{
"type" : "CIMLabelClass",
"expressionTitle" : "Custom",
"expression" : "$feature.Pr_Class",
"expressionEngine" : "Arcade",.............
R_
@RhettZufeltWhat version are you working in? It is interesting to know that removing the labelClasses does not destroy the lyrx, but unfortunately it does not work on my computer(pro 3.1.1). I can import symbology, but labels don't show when activated, and now double clicking on the field names in the label properties has no effect any more. So at the moment I simply have the layer two times, one time without symbols and only labels and the second with the imported symbology. In future I will try to script the symbology instead of importing it.
I have now tested this with 2.9.3 and 3.1.1 and both work the same way.
If I delete "labelClasses": through "labelVisibility": True, (and everything in between), it will just apply the symbology from the layer file, and not the labeling.
If I modify the "expression" : "$feature.LABELFIELD", then load the layer file, it will label with that field instead of the original.
R_