visible fields in ITable and/or IStandaloneTable

2347
2
08-18-2010 03:14 PM
cristiansanabria
New Contributor
I have the following method to set the visibility of a field in a ITable :
public void UpdateAttributeVisibility ( string name, bool visible )
        {
            try
            {
                IWorkspace workspace = Connect( Environment.MachineName, "5151", "sde", "sde", "sde", "DEFAULT", "SampleDataSet" );

                if ( workspace != null )
                {
                    IFeatureWorkspace featureWorkspace = ( IFeatureWorkspace )workspace;
                   
                    string qualifiedName = GetQualifiedName( workspace, "LUPAP_NP_PARCEL" );
                    if ( !string.IsNullOrEmpty( qualifiedName ) )
                    {
                        ITable table = featureWorkspace.OpenTable( qualifiedName );
                        IStandaloneTable standaloneTable = new StandaloneTableClass();
                        standaloneTable.Table = table;
                        if ( table != null )
                        {
                             int index = ( ( ITableFields )standaloneTable ).FindField( name );
                             IFieldInfo info = ( ( ITableFields )standaloneTable ).get_FieldInfo( index );
                             info.Visible = visible;   
                             //now how do I Commit these changes?????????????
                        
                        }
                    }

                }
               
            }
            catch ( Exception exc )
            {
                Log.Fail( exc.StackTrace );
                throw exc;
            }
        }


the question is how can I set visibility of the desired column(field)  so that this visibility is permanent in the ITable?

I would appreciate any help

regards.
0 Kudos
2 Replies
NeilClemmons
Regular Contributor III
A field's visibility setting applies only for the document you've added the table to.  It isn't stored in the database, shapefile, or whatever other datasource you may be using.
0 Kudos
cristiansanabria
New Contributor
A field's visibility setting applies only for the document you've added the table to.  It isn't stored in the database, shapefile, or whatever other datasource you may be using.



So , Isn't There a way to do it??
basically what I need to do is set the visibility of a Field so that this visibility is setted for anytime the attributes table is used.

maybe another approach to do this???

regards.
Cristian.
0 Kudos