# Multiple on all measumerent under one one monitor

**URL:** <https://community.cumulocity.com/t/multiple-on-all-measumerent-under-one-one-monitor/3918>\
**Category:** Forum\
**Tags:** epl-apps, cumulocity\
**Created:** [October 9, 2023, 3:17pm UTC](https://community.cumulocity.com/t/multiple-on-all-measumerent-under-one-one-monitor/3918 "2023-10-09T15:17:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriele.chiossi](https://avatars.discourse-cdn.com/v4/letter/g/7ea924/32.png) [@gabriele.chiossi](https://community.cumulocity.com/u/gabriele.chiossi)\
**Post date:** [October 9, 2023, 3:17pm UTC](https://community.cumulocity.com/t/multiple-on-all-measumerent-under-one-one-monitor/3918/1 "2023-10-09T15:17:04Z")

</div>

hello all,  
how can I have two on all measurements under one monitor?  
I am trying to do something like this, but only the first on all Measurement works while the second one does not, what do I have to fix?

```auto
monitor xxx(){
 action onload(){
  monitor.subscribe(Measurement.SUBSCRIBE_CHANNEL);
  on all Measurement(type=MEASUREMENT_TYPE_A) as measurement
  {
  ...code...
  }
  monitor.subscribe(Measurement.SUBSCRIBE_CHANNEL);
  on all Measurement(type=MEASUREMENT_TYPE_B) as measurement
  {
  ...code...
  }
 }
}

```

---

<div class="post-metadata">

**Author:** ![joel.dockray](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@joel.dockray](https://community.cumulocity.com/u/joel.dockray)\
**Post date:** [October 9, 2023, 3:40pm UTC](https://community.cumulocity.com/t/multiple-on-all-measumerent-under-one-one-monitor/3918/2 "2023-10-09T15:40:26Z")

</div>

The second call to subscribe() is unnecessary. Otherwise, I can see no error in your code. The first listener should trigger for each Measurement received with a type of MEASUREMENT\_TYPE\_A and the second should trigger if a Measurement has instead a type of MEASUREMENT\_TYPE\_B. Are you sure that you are using the correct value for MEASUREMENT\_TYPE\_B and you are successfully creating measurements of this second type?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [April 6, 2024, 3:40pm UTC](https://community.cumulocity.com/t/multiple-on-all-measumerent-under-one-one-monitor/3918/3 "2024-04-06T15:40:31Z")

</div>

Closed on April 6, 2024, 3:40pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
