Feature services doesn't set right attribute values

748
8
08-25-2014 12:46 AM
maximcouton
New Contributor III

Hi,

I have published a feature  service on arcgis server, I am using ajax to push feature to.

I am pushing exactely this data :

var features = [

        {

            "spatialReference" : {

              "wkid" : 2153

            },

            "geometry" : {"x" : 266687.64720000332 , "y" : 6831744.5318000019},

            "attributes" : {

              "name_dept": "test dept",

            }

           

        }

    ];

The request result is a   success , it returns the record ID.

When I Query the service using the record ID  I get the feature but with   name_dept=null  instead of  name_dept = "test dept"

Any Idea ?

Thanks

0 Kudos
8 Replies
RainerSpitzer1
New Contributor III

Hi maxim,

can you please provide the schema of your feature Service? Maybe you created "name_dept" as Integer and not as String-Type...

-

0 Kudos
maximcouton
New Contributor III

Hi Sir ,

He is the schema of name_dept

name_dept ( type: esriFieldTypeString , alias: name_dept , editable: true , nullable: true , length: 30 )

0 Kudos
RainerSpitzer1
New Contributor III

Hi,

if you send your example as written above, try to remove the comma behind "test dept"

var features = [ {

     "spatialReference" : {            

          "wkid" : 2153

     },           

     "geometry" : {

          "x" : 266687.64720000332 ,

          "y" : 6831744.5318000019

     },           

     "attributes" : {             

          "name_dept": "test dept"

     }                

}];

Can you add the feature correctly by using the rest-interface of your featureservice?

-

0 Kudos
maximcouton
New Contributor III

I removed the comma but still not working.

It not working neither in the rest interface of arcgis neither in my code.

When I make a post I get the sucess :

{"addResults": [{

"objectId": 133,

"success": true

}]}

But When I query I get :

{

"objectIdFieldName": "objectid",

"globalIdFieldName": "",

"fields": [

  {

  "name": "name_dept",

  "alias": "name_dept",

  "type": "esriFieldTypeString",

  "length": 30

  }

],

"features": [

  {

  "attributes": {

  "name_dept": null

  }

  }

]

}

So It found the record but does't set the geomtry.

I used ArcMap the view my database , the feature I posted is not inserted in the database.

0 Kudos
RainerSpitzer1
New Contributor III

Hmm,

maybe something with your featureservice isn't set up right. I tried your example using the rest-interface and it worked very well. You can try this, if you want:

http://services1.arcgis.com/vgQLECcJ4FMJQl0M/arcgis/rest/services/brazil_solar_global_10km/FeatureSe...

Paste this into the Box:

[ {

            "spatialReference" : {

              "wkid" : 2153

            },

            "geometry" : {"x" : 266687.64720000332 , "y" : 6831744.5318000019},

            "attributes" : {

              "CEL": "test dept"

            }

}]

You should start getting this work with your service first. Remember that the fieldnames are case-sensitive.

-

0 Kudos
maximcouton
New Contributor III

Hi Sir,

Exactely some thing is wrong with the feature service I am using .

I just wan to  ask you a favor. Can I use your service istead  to do my tests ?

I am developping an API for  that. So I need to use a Feature Service.

0 Kudos
RainerSpitzer1
New Contributor III

Hi maxim,

unfortunately it is not possible to use this Featureservice for your development. But I can help you creating your own FeatureService in your own Developer subscription, if you want.

-

0 Kudos
maximcouton
New Contributor III

If That is ok sir, want the service also to return some fields. Because currently no field is returned.

Thanks a Lot.

0 Kudos