spiskulaesriuk-esridist

Custom .net GPFunction returning GPMultiValueClass and ModelBuilder

Discussion created by spiskulaesriuk-esridist Employee on Mar 28, 2012
Latest reply on May 22, 2012 by nahmed-esristaff
Hi,

I want to create a custom .net GPFunction that would return an object of type GPMultiValueClass.  The result will be used later by other GPTools so i want to be able to pass these values using Model Builder. The problem is that when i connect my output to some other tool, the other tool message says 'Input Feature Layers: Value is required'.

When i do the same thing with any OOB tool that returns multiple values (say for example Collect Values populated with some feature classes) it works fine.  I am suspecting that i should initialize my schema property of the IGPParameterEdit3 object containing the multivalue, but i have no clue what to put there !

                IGPParameterEdit3 outputTest = new GPParameterClass();
                IGPDataType outputTestType = new GPFeatureLayerTypeClass();
                IGPMultiValueType outputTestmvType = new GPMultiValueTypeClass();
                outputTestmvType.MemberDataType = inputType;

                IGPMultiValue outputTestmvValue = new GPMultiValueClass();
                outputTestmvValue.MemberDataType = inputType;

                outputTest.Name = "outLyrs";
                outputTest.DisplayName = "outLyrs";
                outputTest.ParameterType = esriGPParameterType.esriGPParameterTypeDerived;
                outputTest.Direction = esriGPParameterDirection.esriGPParameterDirectionOutput;
                outputTest.DataType = (IGPDataType)outputTestmvType;
                outputTest.Value = (IGPValue)outputTestmvValue;
                outputTest.Enabled = true;

                parameters.Add(outputTest);



Can anyone suggest me how to create an output parameter of type multiple values that could be used by other tools in the model builder? I would really appreciate a snippet showing how to do that.

Thanks,
Szymon

Outcomes