6 Replies Latest reply on Oct 22, 2013 6:43 AM by Francesco Giovinazzo

    Update FieldAlias for an IMMField

    Francesco Giovinazzo

      Hello,

       

      I am programmatically updating various class configurations with a custom tool, like field visibility, field editable, field auto updaters and class auto updaters.

       

      Everything works like a charm, and when I call "IMMConfigTopLevel.SaveFeatureClassToDB(objectClass);" everything is saved.

       

      Now I need to update the Alias of my fields, by looking at the documentation online ( %%ItemTitle%% ) i see that IMMField.FieldAlias let you set the Alias of the field, but when i call the SaveFeatureClassToDB method, the new alias is not saved.

       

      I have searched for the correct approach but with no results.

       

      Anyone can help?

       

      Thanks in advance

       

      Fra

        • Re: Update FieldAlias for an IMMField
          James Wright

          Francesco,

           

          I am not sure exactly why this is not working however I wanted to throw in a side note. If you aren't too far into your development, it may be wise to build the tool to edit the ArcFM Xml configuration and then use the ArcFM Import to make the changes instead of utilizing the API.

           

          You can view the Schema by doing a simple ArcFM Export from the ArcCatalog.

           

          I am not saying you can't use the API for this purpose, just throwing it out there as it may be a simpler approach. If this doesn't sound like what you want, could you provide a code sample demonstrating how you are actually setting/saving this specific property?

          - James

            • Re: Update FieldAlias for an IMMField
              Francesco Giovinazzo

              Thank You James for Your reply,

               

              I will try to propose that as an alternative solution, but having already developed a tool which can handle and update many other ArcFM related things, it will be good to have it working without exporting and importing the xml.

               

              This is basically what I am doing, for each subtype code, the settings and AU part is working smoothly

               

              IMMSubtype subtype = configTopLevel.GetSubtypeForEdit(objectClass, subtypeCode);

               

              IMMField field = null;

              subtype.GetField(fieldIndex, ref field);

               

              field.FieldAlias = "new alias";

               

              ID8List list = field as ID8List;

              list.Reset();

              ID8ListItem listItem = list.Next(false);

               

              while (listItem != null) {

                   // Simple settings

                   if (listItem.ItemType == mmd8ItemType.mmitSimpleSetting) {

                        IMMSimpleSetting simpleSetting = listItem as IMMSimpleSetting;

                        // Visible

                         if (FI_VisibleModified && simpleSetting.SettingType == mmFieldSettingType.mmFSVisible) {

                              simpleSetting.SettingValue = FI_VisibleCheckBox.Checked;

                        }

                        //other settings below...

                   }

                   //autoupdaters below...

               

                   listItem = list.Next(false);

              }

               

              configTopLevel.SaveFeatureClassToDB(objectClass);

               

              I dont know what path to follow to force the update of the field

               

              Thanks

               

              Fra