# On call roster clasification as per sites

**URL:** <https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768>\
**Category:** Ignition\
**Created:** [March 30, 2026, 2:15pm UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768 "2026-03-30T14:15:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [March 30, 2026, 2:15pm UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/1 "2026-03-30T14:15:53Z")

</div>

I have 36 hospital sites and want to assign different roster for different sites, is it possible to show my roster as per the site selection. In below screen I have 7 rosters but as per the site is selected the respective roster will only be shown Is their a way to do this?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/a/cafb42b0c96290d94f1f698a1724af7f9c08c304.png)

---

<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 30, 2026, 3:49pm UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/2 "2026-03-30T15:49:39Z")

</div>

Rosters are a "global" resource. You'd have to make different rosters for each type-of-user across each type-of-site.

What you can do instead, in the alarm notification pipeline, is use a calculated roster to retrieve roster information from a database (or anywhere else you can programmatically define this information) and build it up into a complete roster before it's sent:

> **[Calculated​ - Notification Block | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/alarm-notification/alarm-notification-pipelines/pipeline-blocks/notification-block#calculated)**
>
> As the name suggests, the Notification block is responsible for sending notifications. Each notification block can target multiple notification profiles, which represents different methods of notification, but it will only notify the user on the...

You could even put everyone across all sites into their appropriate roster buckets, then in the calculated roster retrieve all users and filter it down to only the users appropriate to a given site.

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [March 31, 2026, 10:43am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/3 "2026-03-31T10:43:55Z")

</div>

Ok got it Thanks for the info.

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [April 8, 2026, 5:45am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/4 "2026-04-08T05:45:40Z")

</div>

Is it possible to create a customized roster system without using the Gateway, by instead managing everything through a database?  
For example, maintaining a **Users** table (with fields like userID, name, email, phone, etc.) and a **Rosters** table (with rosterID and rosterName), and then assigning users to rosters directly from the database—without needing to configure or add users through the Gateway?

---

<div class="post-metadata">

**Author:** ![Cose\_Peter1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cose_peter1/32/79174_2.png) [@Cose\_Peter1](https://forum.inductiveautomation.com/u/Cose_Peter1)\
**Post date:** [April 8, 2026, 6:21am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/5 "2026-04-08T06:21:35Z")

</div>

Yes. Use calculated roster, like Paul has mention above. The link has examples on how to do it.

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [April 8, 2026, 12:52pm UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/6 "2026-04-08T12:52:22Z")

</div>

I am not able to execute the following script:

```python
def calculateRoster(event, builder):

logger = system.util.getLogger("CalculateRoster")

try:
	rosterID = 1

    logger.info("Fetching roster: {}".format(rosterID))
    
    results = system.db.runNamedQuery("Mediclinic_UCC",
        "CalculatedRoster",
        {"rosterID": rosterID}
    )

results = system.dataset.toPyDataSet(results)

    if not results:
        logger.warn("No users found for roster: {}".format(rosterID))
        return []

    
    for row in results:

        logger.info("Adding user: {}".format(row["Name"]))

       
        builder.username(row["Name"]) \
               .email([row["Email"]] if row["Email"] else []) \
               .phone([row["Phone"]] if row["Phone"] else []) \
               .add()

    
    roster = builder.build()

    logger.info("Final roster size: {}".format(len(roster)))

    return roster

except Exception as e:
    logger.error("Roster calculation failed: {}".format(str(e)))
    return []

```

In namedquery I have checked it is giving correct result but in gateway logs i am getting

![image](https://us1.discourse-cdn.com/inductiveautomation/optimized/3X/4/2/4223a64781cba05a3cd66513393291316389d1c9_2_690x61.png)

---

<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:** [April 8, 2026, 4:06pm UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/7 "2026-04-08T16:06:31Z")

</div>

If this is your exact code, then this line:

> [@prasoon](#):
>
> `results = system.dataset.toPyDataSet(results)`

Is unindented too far, and is closing the scope and preventing the rest of the code from doing anything.

If you don't know basic Python syntax, you won't be able to evaluate your LLM's output with any kind of rigor.

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [April 10, 2026, 7:07am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/8 "2026-04-10T07:07:26Z")

</div>

thanks Paul, in above script indent was proper in the ignition but while pasting I did some mistake so due to that you pointed that out, but even after that same error was coming.

```python
def calculateRoster(event, builder):

logger = system.util.getLogger("CalculateRoster")

try:
	rosterID = 1

    logger.info("Fetching roster: {}".format(rosterID))
    
    results = system.db.runNamedQuery("Mediclinic_UCC",
        "CalculatedRoster",
        {"rosterID": rosterID}
    )
    results = system.dataset.toPyDataSet(results)

    if not results:
        logger.warn("No users found for roster: {}".format(rosterID))
        return []

    
    for row in results:

        logger.info("Adding user: {}".format(row["Name"]))

       
        builder.username(row["Name"]) \
               .email([row["Email"]] if row["Email"] else []) \
               .phone([row["Phone"]] if row["Phone"] else []) \
               .add()

    
    roster = builder.build()

    logger.info("Final roster size: {}".format(len(roster)))

    return roster

except Exception as e:
    logger.error("Roster calculation failed: {}".format(str(e)))
    return []

```

can you plese check again this script and help where I am wrong?  
also does alarm pipeline which is running in gateway is able to fetch DB data?

---

<div class="post-metadata">

**Author:** ![Cose\_Peter1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cose_peter1/32/79174_2.png) [@Cose\_Peter1](https://forum.inductiveautomation.com/u/Cose_Peter1)\
**Post date:** [April 10, 2026, 9:24am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/9 "2026-04-10T09:24:32Z")

</div>

The code that comes after the function definition should have indendation, like this.

```python
def calculateRoster(event, builder):

    logger = system.util.getLogger("CalculateRoster")

    try:
        rosterID = 1

        logger.info("Fetching roster: {}".format(rosterID))
        
        results = system.db.runNamedQuery("Mediclinic_UCC",
            "CalculatedRoster",
            {"rosterID": rosterID}
        )
        results = system.dataset.toPyDataSet(results)

        if not results:
            logger.warn("No users found for roster: {}".format(rosterID))
            return []

        
        for row in results:

            logger.info("Adding user: {}".format(row["Name"]))

        
            builder.username(row["Name"]).email([row["Email"]]).phone([row["Phone"]]).add()

        
        roster = builder.build()

        logger.info("Final roster size: {}".format(len(roster)))

        return roster

    except Exception as e:
        logger.error("Roster calculation failed: {}".format(str(e)))
        return []

```

> [@prasoon](#):
>
> also does alarm pipeline which is running in gateway is able to fetch DB data?

Yes, If you have the correct named query **CalculatedRoster** inside the project named **Mediclinic\_UCC**

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [April 10, 2026, 9:41am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/10 "2026-04-10T09:41:32Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/0/00491b5b743825e43b39e3b7e4096d9ae2799cd2.png)still I am getting that error, below are my screen shoots of named query and their test which is running sucessfully in designer.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/e/dead99c09b0061eb22def6cfbf3c3e0ddebf8c47.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/e/7e1f53d3e76366e5f1524324c07fa2578956f19b.png)

---

<div class="post-metadata">

**Author:** ![Cose\_Peter1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cose_peter1/32/79174_2.png) [@Cose\_Peter1](https://forum.inductiveautomation.com/u/Cose_Peter1)\
**Post date:** [April 10, 2026, 9:51am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/11 "2026-04-10T09:51:51Z")

</div>

Can you expand on the error and see what it says?

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [April 10, 2026, 9:52am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/12 "2026-04-10T09:52:58Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/a/facb35f0bad88d8ed7d1fde86125dd9ab4d32dcb.jpeg)

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [April 10, 2026, 9:54am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/13 "2026-04-10T09:54:31Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/7/c7d48bc522b1bc9db29237961049e7da703fee16.png)But I have the project

---

<div class="post-metadata">

**Author:** ![Cose\_Peter1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cose_peter1/32/79174_2.png) [@Cose\_Peter1](https://forum.inductiveautomation.com/u/Cose_Peter1)\
**Post date:** [April 10, 2026, 9:54am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/14 "2026-04-10T09:54:39Z")

</div>

It's says that **Mediclinic\_UCC** project not found, you should give correct name of the project in the function, system.db.runNamedQuery()

---

<div class="post-metadata">

**Author:** ![Cose\_Peter1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cose_peter1/32/79174_2.png) [@Cose\_Peter1](https://forum.inductiveautomation.com/u/Cose_Peter1)\
**Post date:** [April 10, 2026, 9:55am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/15 "2026-04-10T09:55:23Z")

</div>

> [@prasoon](#):
>
> But I have the project

It has double underscores. **Mediclinic\_\_UCC** instead of **Mediclinic\_UCC**

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [April 10, 2026, 9:59am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/16 "2026-04-10T09:59:05Z")

</div>

I was stuck on this for the past two days, and your help really made a difference. Thank you so much—I truly appreciate it!😍

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [April 13, 2026, 7:51am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/17 "2026-04-13T07:51:34Z")

</div>

Hi **[Cose\_Peter1](https://forum.inductiveautomation.com/u/cose_peter1)** I have to filter the user by hospital name as well I am executing the below script and added the hospitalName as another parameter, on named query side it is running fine but in gateway side its not running (indentation is correct dont worry about it). what am I doing wrong can you help me?

```python
def calculateRoster(event, builder):
	try:
	    rosterID = 1
	    hospitalName = "Mediclinic Bloemfontein"
	
	    logger.info("Fetching roster: {} for hospital: {}".format(rosterID, hospitalName))
	   
	    results = system.db.runNamedQuery(
	        "Mediclinic__UCC",
	        "CalculatedRoster",
	        {
	            "rosterID": rosterID,
	            "hospital": hospitalName
	        }
	    )
	
	    results = system.dataset.toPyDataSet(results)
	
	    if not results:
	        logger.warn("No users found for roster: {} and hospital: {}".format(rosterID, hospitalName))
	        return []
	
	    for row in results:
	        logger.info("Adding user: {}".format(row["Name"]))
	
	        builder.username(row["Name"])\
	               .email([row["Email"]])\
	               .phone([row["Phone"]])\
	               .add()
	
	    roster = builder.build()
	
	    logger.info("Final roster size: {}".format(len(roster)))
	
	    return roster
	
	except Exception as e:
	    logger.error("Roster calculation failed: {}".format(str(e)))
	    return []

```

I am getting below error on gateway.

![image](https://us1.discourse-cdn.com/inductiveautomation/optimized/3X/2/6/2656d19a5192d40804391477f4a172d4f3922926_2_690x53.png)

Also below is my query:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/3/23e460cc0a2db0d7d868f62889ef2682744d7bfa.png)

Which is working perfectly.

---

<div class="post-metadata">

**Author:** ![Cose\_Peter1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cose_peter1/32/79174_2.png) [@Cose\_Peter1](https://forum.inductiveautomation.com/u/Cose_Peter1)\
**Post date:** [April 13, 2026, 9:50am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/18 "2026-04-13T09:50:29Z")

</div>

Seems like there is no data in your DB table for the conditions provided in you sql query. Try testing it by giving rosterID = 1 and hospital = "Mediclinic Bloemfontein" directly on your named query.

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [April 13, 2026, 12:23pm UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/19 "2026-04-13T12:23:36Z")

</div>

Ok Thanks.

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [April 14, 2026, 6:37am UTC](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768/20 "2026-04-14T06:37:31Z")

</div>

@Cose_Peter1 is it possible to make dropdown work as bidirectional, meaning it can give selection values as well as take the values coming from database below is my example:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/8/1882796c9d09d21e19834f807efe401ac0dcddbb.png)

Like whenever I click the user as for example in Pharmacy manager roster only the fields like Name, Title, Email, cell number are getting inserted but not in dropdown as I am using it for selection of region and hospital data to be inserted in DB.  
is it possible?

[Next page](https://forum.inductiveautomation.com/t/on-call-roster-clasification-as-per-sites/114768.md?page=2)
