It looks like we can duplicate rows in standalone tables in Pro 3.1.
I actually rebuilt the function as a Python toolbox and used an insert cursor instead of Append. It should be found along with another tool I created in the first attachment (the 10.3+ version, not the 10.2 version) to this Blog post. I think it still has the refresh issue, but it does not have the inmemory table append issue. It works to append features between feature classes with the same feature type, feature class attributes into standalone table rows, and standalone table rows to standalone table rows for all matching fields, whether the target is the same as the source or different from the source.
I use the other tool in the toolbox more, which creates a single long field key to represent a multiple field composite key in a pair of tables so that they can be joined or related based on matches from the multi-field relationship.
Hi Richard,
It's been a while since you posted your modified script. Where you able to solve any of your questions? Do you still use this script, or do you have a more polished version?
Here's a way to automate Jan's workaround:Open your table.Open the python interpreter windowType in this function>>> def cRows(xTimes): ... for i in range(0, xTimes): ... arcpy.CopyRows_management("tblMyRecords", "tblScratch") ... arcpy.Append_management("tblScratch","tblMyRecords") ... Select a row or the rows you need to copy one or more times and call the function in the python window like this>>> cRows(6) If you need X copies, give the function X - 1; you already have one copy in your table.tblScratch should get written to your default gdb. If the function can't find it, try adding it to your layers.It works inside and outside of an edit session.
>>> def cRows(xTimes): ... for i in range(0, xTimes): ... arcpy.CopyRows_management("tblMyRecords", "tblScratch") ... arcpy.Append_management("tblScratch","tblMyRecords") ...
>>> cRows(6)
def cRows(tblMyRecords, xTimes): arcpy.CopyRows_management(tblMyRecords, "in_memory/tblScratch") for i in range(0, xTimes): arcpy.Append_management("in_memory/tblScratch", tblMyRecords)
cRows("tblMyRecords", 1)
def pasteRow(fc, query): dict = {} for row in arcpy.SearchCursor(fc,query): for x in [k.name for k in arcpy.ListFields(fc) if k.name not in ['OBJECTID','Shape']]: dict = row.getValue(x) irows = arcpy.InsertCursor(fc) row = irows.newRow() for x in dict: row.setValue(x,dict) irows.insertRow(row)
pasteRow(fc,'"SITENAME"=\'PACIFIC AUTO SALVAGE\'')
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.