How to iterate over results from wmtnenumeratenext

Hi - I’m trying to write a tool that scans the server error logs. I call wm.tn.query:eventQuery and then wm.tn.enumerate:next to process the result set.

My problem is that the output of wm.tn.enumerate:next is a java.util.Vector of activity log entries. Try as I may, I cannot seem to access the individual results (I’ve tried looping and also tried mapping the result set to an array of activity log references). There doesn’t seem to be any samples or doco about this.

Can someone point me to the correct way to access these results?

Sonam,

You can use the following piece of code in a java service to convert the Vector to an IData object that you can access and manipulate in your flow services.

IDataCursor cursor = pipeline.getCursor();
IData resultsList = null;

if (cursor.first(“results”))
{
java.util.Vector results = (java.util.Vector)cursor.getValue();
Object objArray = results.toArray();
resultsList =new IData[objArray.length];
for (int i=0; i<objArray.length; i++)
{
resultsList[i] = (IData)objArray[i];
}
}
cursor.insertAfter(“resultsList”, resultsList);

cursor.destroy();

Thanks Rupinder. That worked. I wonder why WM doens’t provide this service as part of the platform.

Just FYI: I cannot use this service as a transformer in a map. If I invoke it as a seperate step, it works perfectly.

Regards,
Sonam