# Reporting Filter on Priority

**URL:** <https://forum.inductiveautomation.com/t/reporting-filter-on-priority/10521>\
**Category:** Ignition\
**Created:** [September 25, 2015, 3:34pm UTC](https://forum.inductiveautomation.com/t/reporting-filter-on-priority/10521 "2015-09-25T15:34:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gadgetguru69](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@gadgetguru69](https://forum.inductiveautomation.com/u/gadgetguru69)\
**Post date:** [September 25, 2015, 3:34pm UTC](https://forum.inductiveautomation.com/t/reporting-filter-on-priority/10521/1 "2015-09-25T15:34:01Z")

</div>

I see no way in new system to bind to min and max priority levels so they can be dynamically filtered on when using Alarm Journal Query. Am i missing something?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 25, 2015, 5:10pm UTC](https://forum.inductiveautomation.com/t/reporting-filter-on-priority/10521/2 "2015-09-25T17:10:22Z")

</div>

You’re right, the Alarm Journal Query doesn’t have dynamic priority selectors, they’re static. We could add this, but in the meantime you could do this with a Script data source as follows.

Imagine you had two report parameters for “MinPriority” and “MaxPriority” which were numbers 0 (diag) - 4 (critical).

you could query the journal and inject the results into the report data map like so:

[code]min = data[“MinPriority”]  
max = data[“MaxPriority”]  
prioRange = range(min, max+1)  
start = data[“StartDate”]  
end = data[“EndDate”]  
journalResults = system.alarm.queryJournal(startDate = start, endDate = end, priority = prioRange, journalName = “MyJournal”)

data[“AlarmJournal”] = journalResults.getDataset()[/code]

---

<div class="post-metadata">

**Author:** ![gadgetguru69](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@gadgetguru69](https://forum.inductiveautomation.com/u/gadgetguru69)\
**Post date:** [September 25, 2015, 6:16pm UTC](https://forum.inductiveautomation.com/t/reporting-filter-on-priority/10521/3 "2015-09-25T18:16:55Z")

</div>

Thanks Carl  
But i was looking for way to use all the other data returned in the Alarm Query Dataset like duration and others.  
As you know this only returns the base columns of the alarm table and linked data if so configured.  
I will stick with our query that does this and if you decide make the priorities dynamic then ill look at this again.

Also i couldn’t get the above code to run. The priority = is looking for strings separated by commas i.e. [“1”,“2”,“3”]  
and the range function is returning 1,2,3

Thanks  
Again
