Delete and re-join row in model builder

1719
8
09-06-2016 01:19 PM
YADOLANO
New Contributor II

Dear members,

I have a loop with the iteration tool in model builder and I want to take the rows out (delete it) but a row per an iteration. The problem when it comes to the second iteration to delete the second row, I see that the first row is also not there since I've deleted it in the first iteration. My question is, how can I do the next iteration (deletion of row #2) with keeping the first row that just deleted in the last step? Any idea would be appreciated.

Thanks in advance

0 Kudos
8 Replies
DanPatterson_Retired
MVP Emeritus

so... you iterate and delete the first row, hence the former second row becomes the first row, so does that mean you want to delete the first row? ... not the original first row, since you deleted it,... but the former 2nd row which is now the first row... and you want to repeat this for all other row X's which decrease in position until they all become the first, then get deleted.

join isn't mentioned in your description, but it is in your title... is there a join somewhere?

perhaps showing your model would help, or at least indicate how long this deletion process will continue would help

YADOLANO
New Contributor II

That is right Dan, I want to iterate the "point.shp" I have, deleting a single row in every iteration. Of course doing some processing in each of those iterations.

0 Kudos
DanPatterson_Retired
MVP Emeritus

but where does the join come into play?

are you always deleting the 'first' row?

are you using an iterator? A quick tour of using iterators—Help | ArcGIS for Desktop 

YADOLANO
New Contributor II

There is no real join but when I delete row #1, for the next iteration I want it to be there or in other words, rejoin it to its first place and delete the second and so on.

0 Kudos
DanPatterson_Retired
MVP Emeritus

if you delete it, it will be gone, you would have to copy it, delete the original and append it (which will go to the end), but I see no easy way of doing this in modelbuilder, since it is largely geared to work with files and not individual features.  You might be better work looking at python, numpy or arcobjects to implement your workflow

YADOLANO
New Contributor II

Thanks Dan, do you know any good book for learning Python for ArcGIS?

0 Kudos
ChrisDonohue__GISP
MVP Alum

Can I ask why you are deleting a row each time?  What is the purpose or reason for doing it this way?  I.e. what does this accomplish?

I ask as I suspect we are missing some of the rationale and there may instead be a much better way to do what you are trying to achieve instead of by iterating and deleting.  It is not very common to delete things in the middle of an iteration; instead one usually selects data differentially as one iterates, then does a process, and if there is a delete it is at the end, after the iteration is completed.  Can you explain what your goal is?  Some context would be helpful.

Chris Donohue, GISP