Select to view content in your preferred language

Change display field/expression for the layer

414
2
10-03-2023 06:20 AM
GISNewbieDev
New Contributor II

 

Hi,

I am creating an in-memory database and then creating a layer and inserting data into it. Then that layer is being added to the active map.  Now I also need to change the display expression for that in-memory layer. For some layers it is a simple expression with combination of multiple field data but for some layers there is a custom logic which will generate a custom display field for the layers.

How can we change the display expression for the layers in this case?

@Wolf @GKmieliauskas @CharlesMacleod 

Tags (1)
0 Kudos
2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Look at the ArcPro SDK community QueryBuilderControl sample.

          // update mapMember definition query
          QueuedTask.Run(() =>
          {
            if (fLayer != null)
              fLayer.SetDefinitionQuery(newExpression);
          });
0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Instead of creating the data on the fly for your memory GDB feature classes, you could have additional fields that hold the result of your custom logic.  This way you can code your custom logic in .Net and use the custom field for display or filtering.   Otherwise, you have to use different definition queries (and Map layers) for each 'custom logic' variant (as mentioned above by @GKmieliauskas )

0 Kudos