Hi folks,
Sorry for reopening this old thread, but I'm experiencing a problem while adapting the above scenario to my needs.
I want to add an information obtained from the assigned data connector and display it in report after iteration number. It works for the first iteration, but then it fails while processing the second iteration, with error "An item with the same key has already been added.".
Simply, it fails during the attempt to add new key/value to CustomProperties. True, the "key" value "CustomField" is still the same, but so is the "CustomFieldStartingTime" in the above example? So what should I need to do to make it working with TC iterations?
Please check the attached sample project. Thanks!
Ranorex version 5.2.3
How to add additional data to the report's iteration activitiy
How to add additional data to the report's iteration activitiy
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to add additional data to the report's iteration activit
Hi odklizec,
We moved your post into a new thread, since we think it was not really connected to the other one.
The post you are referencing to is this one: Timestamps in Report instead of duration.
Regards,
Markus
We moved your post into a new thread, since we think it was not really connected to the other one.
The post you are referencing to is this one: Timestamps in Report instead of duration.
Regards,
Markus
Re: How to add additional data to the report's iteration activit
Hi Markus,
OK, thanks and sorry for the mess. I thought it was more or less about the same problem
OK, thanks and sorry for the mess. I thought it was more or less about the same problem

Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to add additional data to the report's iteration activit
Hello odklizec,
The problem is that you can’t add duplicate keys to a dictionary. I’ve solved the issue as shown below:
Replace:

Regards,
Robert
The problem is that you can’t add duplicate keys to a dictionary. I’ve solved the issue as shown below:
Replace:
Ranorex.Core.Reporting.ActivityStack.Instance.VisitAll(a => { if(a.GetType().Name=="TestIterationActivity") { (a as Activity).CustomProperties.Add("CustomField", " TC: " + " Location: " + cm_Location); } return true; });with:
var actSt = Ranorex.Core.Reporting.ActivityStack.Instance; actSt.CurrentActivity.CustomProperties.Add("CustomField", " TC: " + " Location: " + cm_Location);Hope this helps

Regards,
Robert
Re: How to add additional data to the report's iteration activit
Hi Robert,
Works great! Thanks for the help
Works great! Thanks for the help

Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration