Extract Total Count from Iterator Actions

If would be nice to be able to grab the total count of objects being processed by an iterator action. e.g. using the file iterator you can see the loop count in the GUI status column (loop 5/145 etc). If I could pull that total count I could update run status messages etc...

TJ

Hi TJ

I have made a change so that each iterator action now has a script event called ‘OnAfterInitialisation’ which runs after the iterator action has calculated the total number of items to be iterated over. You can use the ‘IterationCount’ parameter of this event to access the total number of items that will be iterated over.

Here is the link to the build which contains this feature: http://www.automise.com/downloads/automise/400/AT400_143.exe

Hope this helps.

Regards,
Steve

Works a treat! Thanks Steve...

TJ

I just tried using Action.IterationCount property in the OnAfterInitialisation event on a ADO Iterator and I'm not getting a value (yes there are rows returned).

I'm also getting random errors like the one below (iteration could be 170, 300, 801 etc) when using the same ADO Iterator as above (it still throws an error even when there isn't any code in the OnAfterInitialisation event). I believe the connection between the SQL server and Automise is just fine as I have a continuous ping going on and it nevers missing a ping and has low latency. I tried it on eariler versions of AT4 and even AT3 and I still get the "updating iterator status" error, so perhaps it is me, but I thought I'd let you guys know in case you had seen this before...

Error updating iterator status after iteration #801 :
[DBNETLIB][ConnectionRead (recv()).]General network error. Check your network documentation
 

Thanks, TJ.

Hi TJ

The ADO Iterator cannot always guarantee the number of records that will be included after initialisation. Certain providers do not return the number of rows returned so we just continue to read from the record set that was returned until we reach the end of file. In this case the IterationCount property will always return zero and the the initialisation of the iterator will write a log message indicating that an unknown number of rows were returned.

As for the random error you are seeing, this is a very generic issue and can be caused by anything from anti-virus to high network traffic to the database server. I would suggest checking the event logs to see if any further information is available, also it may be worth trying a different connection provider.

Regards,
Steve