Select to view content in your preferred language

Hide Attribute Fields in an attribute table

1182
5
Jump to solution
10-16-2022 04:44 PM
JeromeHaaland
Regular Contributor

Goal --- Hide Attribute Fields in an attribute table

Given a feature class with an attribute table, how would attribute fields be programmatically shown/hidden?

Places already researched...

ProSnippets Editing · Esri/arcgis-pro-sdk Wiki (github.com)

ArcGIS.Desktop.Editing.Controls Namespace—ArcGIS Pro

 

0 Kudos
1 Solution

Accepted Solutions
JeromeHaaland
Regular Contributor

Thank You... This worked perfectly.  Nice little piece of code.

View solution in original post

0 Kudos
5 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Have you tried this:

How-to-change-field-visibility-and-alias 

 

0 Kudos
JeromeHaaland
Regular Contributor

Gintautas,

Thank You for your reply.

Have a Good Day

0 Kudos
FridjofSchmidt
Frequent Contributor

Try this:

var invisibleFields = new[] { "OBJECTID", "HIDDEN_FIELD" };
var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
var fields = layer.GetFieldDescriptions();
foreach (var field in fields)
{
	field.IsVisible = !invisibleFields.Contains(field.Name);
}
layer.SetFieldDescriptions(fields);
0 Kudos
JeromeHaaland
Regular Contributor

Thank You... This worked perfectly.  Nice little piece of code.

0 Kudos
Mehdi20
New Contributor

Hi All,

I have a point feature class with more than 50 fields that mainly consist of fixed values ("Yes" or "No"). I am looking for an approach to only show fields if they have a "Yes" value when I select a feature. For example, when I select a row or pick a point from the map, it only shows fields "A", "B", and "D" where they have a "Yes" value, but don't show field "C" that has a "No" value. And when I select another point, it should show its fields that have a "Yes" value which could be field "A" and "C".

Your feedback appreciated. 

Tags (2)
0 Kudos