stanislav.gusakov-esri-portugal-pt-esridist

How to set up a definition expression?

Discussion created by stanislav.gusakov-esri-portugal-pt-esridist on Apr 14, 2011
Latest reply on Apr 19, 2011 by DGoyal-esristaff
Question update:
Which is the correct syntax to set a definition expression for "Identify" ?

Resolved:
NSString* defString = @"NAME='Mike'";
AGSLayerDefinition* layerDef = [AGSLayerDefinition  layerDefinitionWithLayerId:0 definition:defString];
identifyParams.layerDefinitions = [NSArray arrayWithObject: layerDef];


I have a Map and a feature layer.
In my feature layer there are a lot of features created by different people.
There is a field "NAME" with the feature creator's name.
So, to show the features created only by, let's say "Mike" I am trying to use the following code:

        NSURL *featLURL = [NSURL URLWithString:@"......"];
 self.featureLayer = [AGSFeatureLayer featureServiceLayerWithURL: featLURL mode: AGSFeatureLayerModeOnDemand];

 self.featureLayer.outFields = [NSArray arrayWithObject:@"*"];
        [self.featureLayer setDefinitionExpression:@"NAME=???Mike???"];
 [self.mapView addMapLayer:self.featureLayer withName:@"featurez"];
 self.featureLayer.editingDelegate = self;

Doesn't work. Every feature just disappears from the map. (but they still can be identified)
Any advices?

Edit 1:

it does work like this:
 NSString* defString = @"OBJECTID='1'"; 

But still doesn't work with strings.

Edit 2:
Mkkkay, after restarting the service everything started working. Strange.

Question update:
Which is the correct syntax to set a definition expression for "Identify" ?

Outcomes