# On Call Roster Calculated script

**URL:** <https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [April 18, 2024, 8:27am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024 "2024-04-18T08:27:35Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alagumani\_Kaliyaperu](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Alagumani\_Kaliyaperu](https://forum.inductiveautomation.com/u/Alagumani_Kaliyaperu)\
**Post date:** [April 18, 2024, 8:27am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/1 "2024-04-18T08:27:35Z")

</div>

Hi, I'm working on dynamic on call roster, I try to take the alarm display path to my 'Calculated' script and try to extract the my 'area number' from the display path message. I tried some scripts but that's not help to get my area number.  
can anybody suggested me some script to achieve this function.

Example display path message : "Area 5 sensor triggered"

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 18, 2024, 8:29am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/2 "2024-04-18T08:29:43Z")

</div>

I suggest you don't extract it from the display path, but use associated data instead.

Also, when you have an issue with a script... It's usually a good idea to show that script.  
And don't screenshot it, post code, using the preformatted text tool: ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8a54baadff234cf7e030d937e6095dd4b2148099.png)

---

<div class="post-metadata">

**Author:** ![Alagumani\_Kaliyaperu](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Alagumani\_Kaliyaperu](https://forum.inductiveautomation.com/u/Alagumani_Kaliyaperu)\
**Post date:** [April 18, 2024, 8:45am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/3 "2024-04-18T08:45:16Z")

</div>

Thanks for suggestion can you provide some example for use the associated data.

Please check my script. I'm using the query to get the user information from database, this number is the parameter for my query.  
I checked my query working fine when pass the area number from memory tag.

only part I need to pass correct area number when alarm triggered.

```auto
def calculateRoster(event, builder):
# Get the display path from the event
    display_path = event.getDisplayPath()
    def extract_Area_number(display_path):
        parts = display_path.split()
        for part in parts:
            if part.isdigit():
                return int(part)
        return None  
    area_number = None
    if display_path.startswith("area") and "sensor triggered" in display_path:
        Area_number = extract_area_number(display_path)   
    if area_number is None:        
        return []

```

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 18, 2024, 8:55am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/4 "2024-04-18T08:55:15Z")

</div>

you can configure associated data here:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/4/546e6a93a640530f5e7825fdf1b88e3c3338dd0a.png)

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

Then access it in your roster script with `event['area_number']`

---

<div class="post-metadata">

**Author:** ![Alagumani\_Kaliyaperu](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Alagumani\_Kaliyaperu](https://forum.inductiveautomation.com/u/Alagumani_Kaliyaperu)\
**Post date:** [April 18, 2024, 10:38am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/5 "2024-04-18T10:38:40Z")

</div>

Thanks for your suggestion it's working fine now. 😃

I have other issue my pipeline send two mail notification for one event of alarm. Is there any setting I'm missing in my pipeline.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 18, 2024, 11:54am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/6 "2024-04-18T11:54:10Z")

</div>

Again, we're not mind readers, we can't tell what's wrong with something we've never seen.

---

<div class="post-metadata">

**Author:** ![Alagumani\_Kaliyaperu](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Alagumani\_Kaliyaperu](https://forum.inductiveautomation.com/u/Alagumani_Kaliyaperu)\
**Post date:** [April 19, 2024, 2:35am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/7 "2024-04-19T02:35:21Z")

</div>

![Email notification](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/3/0362bc9f56feac8142876ffef7f0a05922814c3d.png)  
I have attached my Log screen-shot. I always getting two notification each time when alarm triggered.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 19, 2024, 12:21pm UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/8 "2024-04-19T12:21:13Z")

</div>

Again (again !), not mind readers.

Wild guess: Is the alarm on "auto ack" and you've used the same pipeline for "ack pipeline" ?  
Or the same pipeline for "clear pipeline" and the alarm is someone being cleared instantly ?

We can't do much based on just that. You've exposed an issue, but absolutely nothing else.  
To be of any real help, we'll need to see the alarm's configuration and the pipeline, at the very least.

---

<div class="post-metadata">

**Author:** ![Alagumani\_Kaliyaperu](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Alagumani\_Kaliyaperu](https://forum.inductiveautomation.com/u/Alagumani_Kaliyaperu)\
**Post date:** [April 21, 2024, 7:46am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/9 "2024-04-21T07:46:44Z")

</div>

![Email1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/f/6f10ad02103089956b3b36eb9d35383523f4c564.png)  
 ![Email2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/4/f43344231ba61008bac596495f78186ee49b793b.png)  
 ![Email3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/0/f0dd20af0191692e6acfb1bca5868a7f8dbfd70f.png)  
 ![Email4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/2/12216a67e29a5b0d4b9c4a220643f6586703c80c.png)  
I have attached the configuration picture for your reference. I thought log details enough. I have only one pipeline.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 21, 2024, 7:59am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/10 "2024-04-21T07:59:34Z")

</div>

I appreciate the effort of screenshoting things, but...

> [@pascal.fragnoud](#):
>
> we'll need to see the **alarm's configuration**

---

<div class="post-metadata">

**Author:** ![Alagumani\_Kaliyaperu](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Alagumani\_Kaliyaperu](https://forum.inductiveautomation.com/u/Alagumani_Kaliyaperu)\
**Post date:** [April 21, 2024, 8:18am UTC](https://forum.inductiveautomation.com/t/on-call-roster-calculated-script/89024/12 "2024-04-21T08:18:13Z")

</div>

Sure, I attached the picture

 ![Email5](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/1/e1b2ae58db871d9f863d842a8147c8d381da6547.png)
