Edit Table Programatically

598
1
10-09-2012 10:27 AM
TylerWaring
Occasional Contributor II
Greetings Everyone,
This post is very similar to the one that I posted yesterday (http://forums.arcgis.com/threads/68525-featureLayer-applyEdits-Update-attributes-programatically-for...). Since support let me know that I am not able to edit a hidden field, I redesigned my application�??s workflow but am now hitting up against a very similar problem. The redesigned workflow requires that I still edit a standalone table. However, I no longer need to edit a hidden field. Instead I just need to select and edit records in a standalone table. At this point I am unable to.

The code that I am using to try to edit my table is:


1.  First select a set of records from the standalone table using a custom text query class I created.

var textQuery:TextQuery = new TextQuery(activitiesTable.url, ["OBJECTID","FKEY","ACTIVITY","COMMENT","DATE"],strWhereClause, false);
textQuery.executeQuery(neighborhoodUpdataQuery);

2.  Next loop over the records which were returned by my TextQuery class and perform the applyEdits method on the featureLayer:
�??
private function neighborhoodUpdataQuery(event:CoreEvent):void
{
var featureSet:FeatureSet = event.data as FeatureSet;
aryActivitiesAttributes = new Array;
for each (var graphic:Graphic in featureSet.features)
{
  var aryActivityValues:Array = new Array;
    
  var strOBJECTID:String = graphic.attributes.OBJECTID;
  var strFKey:String = graphic.attributes.FKEY;
  var strNeighborhood:String = graphic.attributes.NEIGHBORHOOD;
  var strActivity:String = graphic.attributes.ACTIVITY;
  var strComment:String = graphic.attributes.COMMENT;
  var strDATE:String = graphic.attributes.DATE;
    
  const updates:Object = {
   OBJECTID:strOBJECTID,
                FKEY:"TestValue",
   ACTIVITY:strActivity,
   COMMENT:strComment,
   DATE:strDate
  };
    
  graphic.attributes = updates;
  var aryUpdates:Array = [ graphic ];
  activitiesTable.applyEdits(null, aryUpdates, null);
    
}
}


I can see no problem with my logic, yet I can achieve no updates to my table.

Any direction will be graetly appreciated.
Thanks, Tyler
Tags (2)
0 Kudos
1 Reply
TylerWaring
Occasional Contributor II
As it turns out, the critical mistake I was making was that I had my OBJECTID variable typed as a string. This makes me wonder if it is actually possible to edit a hidden attribute as I had tried to do in my previous post which I referenced earlier in this thread.

Once I finalize and deliver the project that I am working on, I will go back and test to see if you can actually update a hidden field or not. I will report back on the referenced post.

Thanks, Tyler
0 Kudos