gzhong-esristaff

How to edit a table from local map package?

Discussion created by gzhong-esristaff on Nov 15, 2011
Latest reply on Feb 2, 2012 by robert.zargarian@zettate
Hi, All,

The question is about how to edit a table from mpk which is based on a file GDB.

I tried to create a local map service with feature layer, but get an error saying it is a table, but not a feature layer.

I notice a table layer in the published map services is a Joson format. I want to know what is the best way to write a new record to a table inside Runtime and how to read out the coded values out of a table easily?

Thanks,

Gang


Attached code:
localFeatureService = new LocalFeatureService()
            {
                Path = @"C:\temp\testRuntime\Data\CrashReporter.mpk"              
            };
            localFeatureService.StartAsync(x =>
            {
                _LocalFeatureLayer = new ArcGISLocalFeatureLayer()
                {
                    LayerId = 1, // a table
                    Service = localFeatureService,
                    ID = "EditLayer",                
                    Editable = true,
                    AutoSave = false,
                    Mode = FeatureLayer.QueryMode.Snapshot,
                    DisableClientCaching = true,
                    OutFields = new ESRI.ArcGIS.Client.Tasks.OutFields() { "*" },
                };

                ESRI.ArcGIS.Client.Geometry.Envelope initialExtent =
                                    new ESRI.ArcGIS.Client.Geometry.Envelope(
                           new MapPoint(-8642235.3, 5329542.9),
                           new MapPoint(-8641082.8, 5330365.3));
               initialExtent.SpatialReference = new SpatialReference(102100);
               MapControl.Extent = initialExtent;

             MapControl.Layers.Add(_LocalFeatureLayer);

Outcomes