field order is incorrect by reading layer definition file

1886
0
10-15-2012 11:57 AM
xiaoyizhang
New Contributor
All,

I'm working on offline editing in android. I created a map service with feature access on arcGis server 10.1.
I go my layer definition from JSON of my featureserver layer. I created a featurelayer based on my layer definition in my config.xml.
The offline data layer opens OK but I got inccorect field order.

Does anyone have similar issues and solutions?

Thanks,

Xiaoyi Zhang
Dewberry

Here's how I check the fields are in incorrect order,
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                projectDataFeatureLayer = new ArcGISFeatureLayer(projectDataLayerDefinition, null, layerOptions);
  Field[] pField = projectDataFeatureLayer.getFields();
  for (int i = 0; i < pField.length;i++)
  {
   Log.d(TAG,"Seq = " + Integer.toString(i) + " FieldName =  " + pField.getAlias());
  }

  projectDataFeatureLayer.setName(projectDataName);
  loadDataFromSDCard(false);

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

here's layer definition in my config.xml
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<string name="config.projectData.layer.definition">
{
\"currentVersion\": 10.1,
\"id\": 0,
\"name\": \"electrical\",
\"type\": \"Feature Layer\",
\"description\": \"The feature class consists of the surveyed electrical transformers and panel point locations, required attribution, and digital photographs.\",
\"copyrightText\": \"Dewberry\",
\"defaultVisibility\": true,
\"editFieldsInfo\": null,
\"ownershipBasedAccessControlForFeatures\": null,
\"syncCanReturnChanges\": false,
\"relationships\": [],
\"isDataVersioned\": true,
\"supportsRollbackOnFailureParameter\": false,
\"supportsStatistics\": true,
\"supportsAdvancedQueries\": true,
\"geometryType\": \"esriGeometryPoint\",
\"minScale\": 0,
\"maxScale\": 0,
\"extent\": {
  \"xmin\": 2605295.8095349073,
  \"ymin\": 382963.4198536724,
  \"xmax\": 2607622.8711894006,
  \"ymax\": 386063.8142192513,
  \"spatialReference\": {
   \"wkid\": 102728,
   \"latestWkid\": 2271
  }
},
\"drawingInfo\": {
  \"renderer\": {
   \"type\": \"simple\",
   \"symbol\": {
    \"type\": \"esriPMS\",
    \"url\": \"6174d66fd830441a571ea7db733c0116\",
    \"imageData\": \"iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAW9JREFUKJGd0r0vQ1EYx/Hvpbc3N6lWrpfkeiliMoiBUSISCQsWf4IwaywY7CIIg7CLwWIQbwshYkCiQgxMqj0R6U21Go63Y6AoTYlnO8Pnye88+bn457jSXsPKJEYPT8ku7hPluM1r3L4lFFNMak5mGFBVXIQ2eIhVoOeB2wsPiQrioQZ0I2D0qTY5ru2mw25lED3dxCjw4639stcCTxk83nrlVXCdgKphTLv8gIY8HZKGz49ZnPlDugfyqz1EDqaB9g8oZbwDqyb7NXQP5OQ2pkfVzfzs6n3MQh+0lsJa+A2q5/ifYK55Y9tHlhC8w2Q0SBG1vzBIRg6EEOHPqNuzG1S2NAOlWdg954srgPMJnYVVKzjjdep6B4BMp72zxP4gZxM7qRakChDhaHCH2Hm/0TRSL5XWiUYJECVHrXM8t5zc6o5LKff4BnEcZw9nNCwPR5+ALeAF0AC3bdsnQsqTrxHSuwoRYP57TiHEj+yvy5KBRXegRPYAAAAASUVORK5CYII=\",
    \"contentType\": \"image/png\",
    \"width\": 10,
    \"height\": 10,
    \"angle\": 0,
    \"xoffset\": 0,
    \"yoffset\": 0
   },
   \"label\": \"\",
   \"description\": \"\"
  },
  \"transparency\": 0,
  \"labelingInfo\": null
},
\"hasM\": false,
\"hasZ\": true,
\"enableZDefaults\": false,
\"allowGeometryUpdates\": true,
\"hasAttachments\": false,
\"htmlPopupType\": \"esriServerHTMLPopupTypeAsHTMLText\",
\"objectIdField\": \"OBJECTID\",
\"globalIdField\": \"\",
\"displayField\": \"panel_id\",
\"typeIdField\": \"\",
\"fields\": [
  {
   \"name\": \"OBJECTID\",
   \"type\": \"esriFieldTypeOID\",
   \"alias\": \"OBJECTID\",
   \"domain\": null,
   \"editable\": false,
   \"nullable\": false
  },
  {
   \"name\": \"panel_id\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"panel_id\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  },
  {
   \"name\": \"existing_id\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"existing_id\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  },
  {
   \"name\": \"orig_id\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"orig_id\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  },
  {
   \"name\": \"manuf_id\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"FKManufID\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 50
  },
  {
   \"name\": \"mounting\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"mounting\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  },
  {
   \"name\": \"facil_id\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"FKFacilID\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  },
  {
   \"name\": \"floor_id\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"floor_id\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  },
  {
   \"name\": \"room_id\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"room_id\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  },
  {
   \"name\": \"feat_desc\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"feat_desc\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 60
  },
  {
   \"name\": \"lt_desc\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"lt_desc\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 10
  },
  {
   \"name\": \"panel_dim\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"panel_dim\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  },
  {
   \"name\": \"width\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"width\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 16
  },
  {
   \"name\": \"depth\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"depth\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 16
  },
  {
   \"name\": \"height\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"height\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 16
  },
  {
   \"name\": \"no_phases\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"NoPhases\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  },
  {
   \"name\": \"main_breaker\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"main_breaker\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  },
  {
   \"name\": \"amp_rate\",
   \"type\": \"esriFieldTypeSmallInteger\",
   \"alias\": \"AmpRate\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true
  },
  {
   \"name\": \"voltage_d\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"VoltageDOM\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 16
  },
  {
   \"name\": \"hertz_d\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"HertzDOM\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 16
  },
  {
   \"name\": \"no_circuit\",
   \"type\": \"esriFieldTypeInteger\",
   \"alias\": \"no_circuit\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true
  },
  {
   \"name\": \"use_circuit\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"use_circuit\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 5
  },
  {
   \"name\": \"serial_no\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"SerialNo\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 15
  },
  {
   \"name\": \"coord_id\",
   \"type\": \"esriFieldTypeString\",
   \"alias\": \"FKCoordID\",
   \"domain\": null,
   \"editable\": true,
   \"nullable\": true,
   \"length\": 20
  }
],
\"types\": [],
\"templates\": [
  {
   \"name\": \"electrical\",
   \"description\": \"\",
   \"prototype\": {
    \"attributes\": {
     \"coord_id\": null,
     \"panel_id\": null,
     \"existing_id\": null,
     \"orig_id\": null,
     \"manuf_id\": null,
     \"mounting\": null,
     \"facil_id\": null,
     \"floor_id\": null,
     \"room_id\": null,
     \"feat_desc\": null,
     \"lt_desc\": null,
     \"panel_dim\": null,
     \"width\": null,
     \"depth\": null,
     \"height\": null,
     \"no_phases\": null,
     \"main_breaker\": null,
     \"amp_rate\": null,
     \"voltage_d\": null,
     \"hertz_d\": null,
     \"no_circuit\": null,
     \"use_circuit\": null,
     \"serial_no\": null
    }
   },
   \"drawingTool\": \"esriFeatureEditToolPoint\"
  }
],
\"maxRecordCount\": 1000,
\"supportedQueryFormats\": \"JSON, AMF\",
\"capabilities\": \"Create,Delete,Query,Update,Uploads,Editing\"
}
</string>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
0 Kudos
0 Replies