# Combing multiple rosters to a single roster

**URL:** <https://forum.inductiveautomation.com/t/combing-multiple-rosters-to-a-single-roster/71349>\
**Category:** Ignition\
**Created:** [March 20, 2023, 11:09pm UTC](https://forum.inductiveautomation.com/t/combing-multiple-rosters-to-a-single-roster/71349 "2023-03-20T23:09:14Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 21, 2023, 10:15pm UTC](https://forum.inductiveautomation.com/t/combing-multiple-rosters-to-a-single-roster/71349/7 "2023-03-21T22:15:45Z")

</div>

Your code has a lot of problems.

Chiefly:

1. You're not returning the contact infos as a _list_ of possible contact infos
2. You're not differentiating between SMS, email, or phone numbers, which you would want to do.
3. You don't need to call `system.user.getUser` if you use `system.roster.getRoster()`, which directly returns `User` objects
4. Hardcoding in `default` to the `system.user.getUser` function is also a bad idea.
5. You're returning in the wrong format anyways: you're returning something like:

```python
[
  { "Maintenance Roster": [
    { "joe": [contactInfo] }
    ]
  }
]

```

But you need to return a direct list of user-like objects; see the manual:  
[https://docs.inductiveautomation.com/display/DOC81/Notification+Block#NotificationBlock-Calculated](https://docs.inductiveautomation.com/display/DOC81/Notification+Block#NotificationBlock-Calculated)

A generic `mergeRosters` suitable for use in a calculated roster script would be something like this:

```python
	def mergeRosters(*rosterNames):
		return [
		    dict(username = user.get(user.Username), **{ci.contactType: ci.value for ci in user.contactInfo})
			for rosterName in rosterNames
			for user in system.roster.getRoster(rosterName).users
		]
	
	return mergeRosters("day shift", "night shift")

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/combing-multiple-rosters-to-a-single-roster/71349)._
