0
param5 = arcpy.Parameter(
        name="C",
        displayName="C",
        direction="Input",
        datatype="DEFeatureClass",
        parameterType="Required",
        multiValue=True)

    parameters = [param0, param1, param2, param3, param4, param5]

    return parameters

enter image description here

And now I want to get each of layer from param5. I must do this such as here?

c = parameters[5] c1 = c[0].valueAsText c2 = c[1].valueAsText

Multivalue parameter is a list? What is the way that get each of leyer? If I would like to do Merge (http://pro.arcgis.com/en/pro-app/tool-reference/data-management/merge.htm). That's enough pass parameters[5] as first argument to Merge_management??

1 Answer 1

2

You can easily print the contents of the c by using arcpy.AddMessage(c) in your execute method. This will show up fc1path;fc2path text in the dialog box window. That is, the multivalues are semicolon delimited.

You can pass the parameter as is to any geoprocessing tool that can work with multivalues such as Merge. If you want to do finer processing of each input feature class, you could use Python split() method to get each of the path:

s = 'path1;path2;path3'
s.split(';')
['path1', 'path2', 'path3']
1
  • Now imagine you have someone who likes to use semicolons in layer names like: "US; California; Los Angeles; Roads". The events, characters and firms discussed are fictitious. Any similarity to actual persons, living or dead, or to actual firms, is purely coincidental :)
    – Miro
    Commented Jul 10, 2019 at 5:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.