how to define MULTIPLE DissolveTool.Dessolve_fields

263
5
Jump to solution
01-25-2012 07:23 AM
JohnLove
New Contributor
When I attempt to define more than one dissolve_field I get an error. If I define only one, it runs just fine. The documentation http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Dissolve/00170000005n000000/ indicates that the use of multiple dissolve_fields and/or statistics_fields is possible but I've tried every combination of input parameters that I can think of but so far, it only works with a single field. Below is the VB.Net code I've used with the message (error) below each.

Has anyone successfully implemented this using more that one dissolve_field and/or statistics_fields?


CODE THAT FAILS:

                Dim DissolveTool As ESRI.ArcGIS.DataManagementTools.Dissolve = New Dissolve

                DissolveTool.in_features = wksSource & "\" & fClassFloorArea_S
                DissolveTool.out_feature_class = wksDestination & "\" & fClassTemp
                DissolveTool.dissolve_field = "instln_id, facil_id"
                DissolveTool.multi_part = True
                RunTool(GP, DissolveTool, Nothing)


ERROR MESSAGE:

Failed to execute. Parameters are not valid.
ERROR 000728: Field instln_id, facil_id does not exist within table
Failed to execute (Dissolve).


CODE THAT WORKS:

                Dim DissolveTool As ESRI.ArcGIS.DataManagementTools.Dissolve = New Dissolve

                DissolveTool.in_features = wksSource & "\" & fClassFloorArea_S
                DissolveTool.out_feature_class = wksDestination & "\" & fClassTemp
                DissolveTool.dissolve_field = "facil_id"
                DissolveTool.multi_part = True
                RunTool(GP, DissolveTool, Nothing)


SUCCESSFUL MESSAGE:

Executing: Dissolve ...

Start Time: Wed Jan 25 12:12:54 2012
Sorting Attributes...
Dissolving...
Succeeded at Wed Jan 25 12:12:56 2012 (Elapsed Time: 2.00 seconds)
0 Kudos
1 Solution

Accepted Solutions
ChrisSnyder
Regular Contributor III
In this case, use a space as the delimiter. However, if you have multiple fields/stats then you would use a semicolon.

DissolveTool.statistics_fields = "instln_id FIRST"

or

DissolveTool.statistics_fields = "instln_id FIRST; otherfield SUM"

View solution in original post

0 Kudos
5 Replies
ChrisSnyder
Regular Contributor III
Try using a semicolon as the field name delimiter. For example:

dislvFields = "FIELD1;FIELD2"

In Python in v10.0 you can also use list objects as input. For example:

dslvFields = ["FILED1","FIELD2"]
0 Kudos
JohnLove
New Contributor
Thanks Chris!

That works perfectly for the dissolve_field. When I try to set the statistics_fields like this

DissolveTool.statistics_fields = "instln_id,{FIRST}"


I get this error:
Failed to execute. Parameters are not valid.
ERROR 000315: Statistic field instln_id must NOT be of type TEXT unless methods are FIRST or LAST
Failed to execute (Dissolve).

John
0 Kudos
ChrisSnyder
Regular Contributor III
In this case, use a space as the delimiter. However, if you have multiple fields/stats then you would use a semicolon.

DissolveTool.statistics_fields = "instln_id FIRST"

or

DissolveTool.statistics_fields = "instln_id FIRST; otherfield SUM"

View solution in original post

0 Kudos
JohnLove
New Contributor
Thanks again Chris! Worked perfectly.

John
0 Kudos
ChrisSnyder
Regular Contributor III
:cool: Glad it helped
0 Kudos