Custom geoprocessing function tool

2947
2
07-28-2015 09:45 AM
BrettLawson
New Contributor III

I'm trying to write a custom geoprocessing function tool in ArcObjects that I can then expose as a service on ArcServer.  The output parameter will be a zip file that contains a filegeodatabase.  I have marked the parameter as a required and attempted to set some of the default properties of the GPDataFile class, but when I run my try task, no matter what I type into the "Output Export File" input box I get a message saying that it is required.  Does anybody have any samples on how to use and set the properties of the GPDataFile class to be used as an output parameter.

            IGPDataFile gRDL = new GPDataFileClass();              

            gRDL.DataType = "zip";

            gRDL.DatasetName = "TableName";


            IGPParameterEdit3 inputParameter = new GPParameterClass();
            inputParameter.DataType = new GPDataFileTypeClass();

            // Default Value object
            inputParameter.Value = gRDL as IGPValue;

            // Set Parameter properties
            inputParameter.Direction = esriGPParameterDirection.esriGPParameterDirectionOutput;
            inputParameter.DisplayName = "Output Export File";
            inputParameter.Name = "out_export_file";
            inputParameter.ParameterType = esriGPParameterType.esriGPParameterTypeRequired;
            return inputParameter;

Thanks,

Brett

Message was edited by: Brett Lawson It appears that using the DEFileTypeClass works, but now I'm curious as to what the difference between that class and the GPDataFileTypeClass

0 Kudos
2 Replies
FreddieGibson
Occasional Contributor III

Are you setting the parameters type to Required because you want the user to be able to specify the output path on disk? If not, have you tried setting the type to derived?

0 Kudos
GregMcQuat
New Contributor III

Echoing Freddie. Probably something to do with validation on the output file param.

Try making the parameter an input that is simply a path to the output location and have a separate derived output parameter. You can validate and / or update the name in the validation step to make sure that the path is a .zip file.

0 Kudos