For-Each Loop

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
3 posts Page 1 of 1

pshuey

Posts: 3
Joined: Tue Dec 30, 2014 1:31 pm

Post by pshuey » Wed Jan 21, 2015 2:13 pm
I am trying to load a .xlsx file from the ifs and then read through it a row at a time using a rowset and a For-Each Loop. Within the loop I am inserting the row into a database file. The database file has a sequence number in it and I was trying to use an index from the For-Each Loop for the sequence number. It is crashing after the first insert, giving me a duplicate key error. The duplicated is caused by the sequence number not incrementing. Is there a sample program that I can look at to figure out what I am doing wrong?

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Mon Feb 02, 2015 9:41 am
Please post a copy of your Project XML and the associated JobLog (in debug mode) so that we can see what you're trying to accomplish.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Mon Feb 09, 2015 10:50 am
Patti,

Look at removing the ${Row} from the "Insert Rowset Variable" inside of the For-Each loop on the Insert of your data. You're telling the project to insert every row from the rowset each time through, thus .. the 2nd time through you are trying to insert the same data again, giving you duplicates.

Once inside the For-Each loop, you're controlling the insert of each record, so, the input rowset variable isn't needed in this case.

Hope this helps!
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
3 posts Page 1 of 1