Using multiple inputs

About using multiple inputs

Tools can accept single or multiple inputs, depending on the operation. Tools that convert or overlay data can accept multiple datasets as input because of the nature of the operation.
In a program, inputs are passed to these tools as a multivalue string, which uses a semicolon to separate each input in the string. A multivalue string is easy to construct in a program using the string manipulation functions built into the language.
In the following code example, a multivalue string is created with Java concatenation capabilities and used with the Union tool:
If you union more than two feature classes, you need an ArcInfo License.
gp.setEnvironmentValue("workspace", multiWorkspace);
IGpEnumList polygonFCs = gp.listFeatureClasses("", "polygon", "");
String polygon =;
String polygonsToUnion = "";
while (!"" .equals(polygon)){
    polygonsToUnion += polygon;
    polygon =;
    if (!"" .equals(polygon)){
        polygonsToUnion += ";";

Union union = new Union(polygonsToUnion, outputWorkspace + "/unioned.shp");
gp.execute(union, null);