Select to view content in your preferred language

Accessing "derived output" values of Append tool

287
3
06-06-2024 07:07 AM
Sfortunatamente
New Contributor III

I have a simple script which uses the Append gp tool with the option to update existing records (upsert). I am trying to access  derived output parameters "appended_row_count" and "updated_row_count". Are these elements of the list? I am getting The index 1 is out of range error.

When I check the Get count gp tool output parameter ("row_count") it is being accessed as the first element of the list. It does not seem to be working for me for the other tool.

How to get these two long integer values in the py script?

Thanks.

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

not sure I follow, but anyway, the first element of a python list is 0, if index 1 is being queried and doesn't exist, that is why you are getting the error

another possibility is that a list is being returned (index 0) which may contain more than 1 element eg 0 and 1) so you would have to get the list then index into it


... sort of retired...
0 Kudos
Sfortunatamente
New Contributor III

Yeah, I put the question is a quite complicated way. Look at the screenshot.

the code is:

loaded = arcpy.management.Append(
inputs=inputLayer,
target=destTable,
schema_type="NO_TEST",
field_mapping=None,
subtype="",
expression="",
match_fields="keyfield keyfield",
update_geometry="UPDATE_GEOMETRY"
)

it appends the data. If you look at the tool description in the section of the Derived Output you see three parameters. I do not know how to get a second and third long integer value. When printing "loaded" I get only path to target feature class.

0 Kudos
Sfortunatamente
New Contributor III

Sorry, my fault. I have Pro 3.2. Three parameters in the Append tool are available in version 3.3.. 

0 Kudos