AnsweredAssumed Answered

Access Fields Name for particular Layer with LayerID

Question asked by gajanaik on Aug 14, 2015
Latest reply on Aug 14, 2015 by njarecha-esristaff

Hello,

 

its urgent ...

 

i actually tried ways , even checked ESRI sample code QueryTaskExample.  i need simply to get Fields Names or Attributes of any Layer .

 

i used following method...

 

            self.queryTask = [AGSQueryTask queryTaskWithURL:[NSURLURLWithString:strMAPURL]]; // here i send like @"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3"

 

 

            self.queryTask.delegate = self;

          

            //return all fields in query

            self.query = [AGSQuery query];

            self.query.outFields = [NSArray arrayWithObjects:@"*", nil];

 

            self.query.text = @"Fields"; // with out this line or without empty query it gives error

            [self.queryTask executeWithQuery:self.query];

 

i access below delegates :

 

//results are returned

- (void)queryTask:(AGSQueryTask *)queryTask operation:(NSOperation *)op didExecuteWithFeatureSetResult:(AGSFeatureSet *)featureSet {

  //get feature, and load in to table

  self.featureSet = featureSet;

  [super.tableView reloadData];

}

 

featureSet.fields  // this should be giving me Name of Fields for Layer 3....

 

but i am getting Array as 0 elements......  i need to get Fields name in same order as there in Server Layer....

Outcomes