@gskn
The values for record_id you give us are always the same. Not sure if that's just because it's not representative sample data or not.
What you need is something that ties the error messages to the data records. If the error messages always below to the latest data record then ideally just use record_id (if unique per data record) or create your own id - which could simply be a counter increased by 1 whenever you read a data record.
Else: I believe the code I've already posted should give you sufficient guidance to work out the last details yourself.
... View more