# system.alarm.queryStatus with multiple source paths

**URL:** <https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 6, 2022, 4:29am UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545 "2022-07-06T04:29:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [July 6, 2022, 4:29am UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/1 "2022-07-06T04:29:17Z")

</div>

Hello,

Can anyone explain to me how to pass this function multiple paths including wildcards. I have tried a comma seperated list with no luck.

Thanks,

Frank

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 6, 2022, 6:08am UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/2 "2022-07-06T06:08:51Z")

</div>

![Screenshot_20220706-153825_Chrome](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/3/e35a77b2427aae2efafd047423e34893d3e81057.jpeg)

You need to pass in a list of paths  
Eg.

```auto
["*hello", "*world"]

```

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [July 6, 2022, 12:43pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/3 "2022-07-06T12:43:18Z")

</div>

I am seeing some odd behavior here.

```auto
> This works: *ABC123*
> This works: [*ABC123*]
> This does not work: "*ABC123*"
> This does not work: ["*ABC123*"]
> This does not work: ["*ABC123*","*CDE456*"]

```

Any ideas? Also I am calling this function from a script module and passing the filter into the function FWIW.

Thanks,

Frank

---

<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:** [July 6, 2022, 1:11pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/4 "2022-07-06T13:11:32Z")

</div>

What’s `*ABC123*` here ? Is it already a string ? can you tell us what `type(*ABC123*)` returns ?

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [July 6, 2022, 1:20pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/5 "2022-07-06T13:20:54Z")

</div>

```auto
def hasActiveUnack(Filter):
    import system
    try:
        if len(system.alarm.queryStatus(source=str(Filter),state = ["ActiveUnacked"])) > 0:
            return type(Filter)
        else:
            return type(Filter)
    except:
        return 0

def hasActiveAck(Filter):
            import system
            try:
                if len(system.alarm.queryStatus(source=str(Filter),state = ["ActiveAcked"])) > 0:
                    return type(Filter)
                else:
                    return type(Filter)
            except:
                return 0
def hasClearUnack(Filter):
            import system
            try:
                if len(system.alarm.queryStatus(source=str(Filter),state = ["ClearUnacked"])) > 0:
                    return type(Filter)
                else:
                    return type(Filter)

            except:
                return 0

```

Here are my script functions, modified temporarily to return type

It returns back class org.python.core.PyUnicode

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [July 6, 2022, 1:33pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/6 "2022-07-06T13:33:43Z")

</div>

It is definitely related to passing the source list into the function. If I hard code source=`["*ABC123*","*CDE345*"]` it works fine.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [July 6, 2022, 1:52pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/7 "2022-07-06T13:52:51Z")

</div>

You may find it beneficial to call `system.alarm.queryStatus` once vs multiple times. You can get away with it if you aren’t calling it that much, but 100s of times and you might start seeing lag.

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [July 6, 2022, 2:11pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/8 "2022-07-06T14:11:36Z")

</div>

While I agree with this statement my issue seems to be syntactical in nature. I surely cannot be the first person to call system.alarm.queryStatus inside a function passing in source or display path.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [July 6, 2022, 2:33pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/9 "2022-07-06T14:33:58Z")

</div>

> [@franklepkowski](#):
>
> my issue seems to be syntactical in nature

Indeed.

When you call `system.alarm.queryStatus()` you're using `str(Filter)` which will try to convert whatever filter is to a string. So when you send `["*abc123*"]` it gets converted to the string  
`"['*abc123*']"`  
which isn't valid.

However, you asked how to pass the function multiple _ **paths** _ including wildcards,but your script is attempting to pass multiple _ **sources** _. Which are you really wanting to do?

To pass multiple _paths_ the correct syntax is:

```python
flt = ['*abc123*','*CDE456*']
system.alarm.queryStatus(path=flt) #set state and/or priority as needed

```

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 6, 2022, 7:45pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/10 "2022-07-06T19:45:26Z")

</div>

> [@franklepkowski](#):
>
> ```auto
> def hasActiveUnack(Filter):
> import system
> try:
> if len(system.alarm.queryStatus(source=str(Filter),state = ["ActiveUnacked"])) > 0:
> return type(Filter)
> 
> ```

I question **why** youre converting the filter into a string? This is why it's not working, as you're not passing a list into the function

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [July 6, 2022, 11:18pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus-with-multiple-source-paths/61545/11 "2022-07-06T23:18:08Z")

</div>

Yes, this was a foobar on my part, I have since corrected it and have it working properly. Thanks for the replies.

Frank
