s.offermannconterra-de-esridist

How to set displayFieldName of GP-Service in C#?

Discussion created by s.offermannconterra-de-esridist Employee on Feb 7, 2014
Latest reply on Feb 10, 2017 by salvador.jp
I am developing a GP-Service with C#. The output is a feature set containing some attribute values. I want to determine the primary display field, which is contained in the output parameter (6th line, currently the empty string ""):

{
 "results": [{
  "paramName": "result",
  "dataType": "GPRecordSet",
  "value": {
   "displayFieldName": "",
   "geometryType": "esriGeometryPoint",
   "spatialReference": {
    "wkid": 102100,
    "latestWkid": 3857
   },
   "fields": [ ... ],
   "features": [],
   "exceededTransferLimit": false
  }
 }],
 "messages": [ ... ]
}


This is how I built the ParameterInfo:
IGPParameterEdit3 result = new GPParameterClass();
IFeatureClass outputFeatureClass = DoneInAnotherMethod(); // open template from disk
result.DataType = new GPFeatureRecordSetLayerTypeClass();

IRecordSetInit recordset = new RecordSetClass();
recordset.SetSourceTable((ITable)outputFeatureClass, null);

IGPRecordSet recordSet = new GPRecordSetClass();
recordSet.RecordSet = (IRecordSet)recordset;

IGPRecordSet gpRecordSet = new GPFeatureRecordSetLayerClass();
gpRecordSet.RecordSet = new RecordSetClass();
gpRecordSet.RecordSet = (IRecordSet)recordset;

var featureRecordSetLayer = (IGPFeatureRecordSetLayer)gpRecordSet;
result.Value = (IGPValue)featureRecordSetLayer;
result.Name = Constants.OutputParameterName;
result.DisplayName = Constants.OutputParameterName;
result.Direction = esriGPParameterDirection.esriGPParameterDirectionOutput;
result.ParameterType = esriGPParameterType.esriGPParameterTypeDerived;
result.Enabled = true;

IGPFeatureSchema featureSchema = new GPFeatureSchemaClass();
featureSchema.GeometryType = esriGeometryType.esriGeometryPoint;

IGPFeatureClassDomain geomTypeDomain = new GPFeatureClassDomainClass();
geomTypeDomain.AddType(esriGeometryType.esriGeometryPoint);
result.Domain = (IGPDomain)geomTypeDomain;
result.Schema = (IGPSchema)featureSchema;

myParameterInfo.Add(result);


How can I set this value? I cannot find anything useful in ArcObjects. Any Idea?

Best regards, Stefan

Outcomes