# Event Get Query Match All Not Working?

**URL:** https://forums.losant.com/t/event-get-query-match-all-not-working/4355
**Category:** Help
**Tags:** workflow
**Created:** [February 16, 2022, 2:27pm UTC](https://forums.losant.com/t/event-get-query-match-all-not-working/4355 "2022-02-16T14:27:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Edward\_Cline](https://avatars.discourse-cdn.com/v4/letter/e/67e7ee/32.png) [@Edward\_Cline](https://forums.losant.com/u/Edward_Cline)
#### Post date: [February 16, 2022, 2:27pm UTC](https://forums.losant.com/t/event-get-query-match-all-not-working/4355/1 "2022-02-16T14:27:38Z")

</div>

I have setup an Event: Get node in a workflow using mutliple fields and match “ALL” type query. The node returns an event even though the items don’t match. What am I doing wrong here?

 ![1](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/8/8eafe13889ff52d83ef805ca92911b7c7a22ffa5.png)

This is a loop workflow, so I use the mutate block to remove `working.lastEvent` from the payload before the Event: Get node, so there is no stale info on the payload as shown below.

![2](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/9/98cb7e3bdf16e613514303e715b16dc0d930a8dc.png)

The input is `working.currentAlertSettings` and the output is `working.lastEventInfo`. Detailed payload after the Event: Get is shown below:

```auto
    "currentAlertSettings": {
      "index": 1,
      "value": {
        "ackRequiredToClear": true,
        "attribute": "ch1pv",
        "createdAt": "2021-05-11T12:51:33.989Z",
        "deviceId": "609a7dd145c8a20006498f53",
        "deviceName": "Demo Gateway IAC",
        "enabled": true,
        "id": "609a7dd545c8a200064994b8",
        "level": 90,
        "logic": 0,
        "name": "LO Header Pressure",
        "notificationsEnabled": true,
        "severity": 3,
        "severityStr": "critical",
        "throttleEnabled": false,
        "throttleLimit": 0,
        "updatedAt": "2021-05-11T12:51:33.989Z"
      }
    },
    "currentAttribute": {
      "index": 1,
      "key": "ch1pv",
      "value": 85.46
    },
    "lastEventInfo": {
      "applicationId": "609a7dd145c8a20006498f00",
      "creationDate": "2021-06-07T20:33:03.243Z",
      "deviceId": "609a7dd145c8a20006498f53",
      "deviceName": "IAC Smart Plant Demo",
      "eventId": "60be827f35fa3f0007667fbe",
      "eventTags": {
        "ackRequiredToClear": "true",
        "attribute": "ch3pv",
        "deviceId": "609a7dd145c8a20006498f53",
        "deviceName": "Demo Gateway IAC",
        "enabled": "true",
        "level": "1.5",
        "logic": "1",
        "name": "HI Differential Pressure",
        "notificationsEnabled": "true",
        "severity": "3",
        "severityStr": "critical",
        "throttleEnabled": "false",
        "throttleLimit": "0"
      },
      "id": "60be827f35fa3f0007667fbe",
      "lastUpdated": "2021-06-07T20:33:03.389Z",
      "level": "critical",
      "message": "Limit: 1.5 Value: 3.04 Logic: 1 Severity: critical AckRequiredToClear: true",
      "sourceId": "609a7dd145c8a200064991ea",
      "sourceName": "process attribute alerts",
      "sourceType": "flow",
      "state": "new",
      "subject": "HI Differential Pressure",
      "updates": [
      ]
    }

```

---

<div class="post-metadata">

### Author: ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)
#### Post date: [February 16, 2022, 3:17pm UTC](https://forums.losant.com/t/event-get-query-match-all-not-working/4355/2 "2022-02-16T15:17:29Z")

</div>

Based on what you’ve provided here, I’m not seeing where the issue lies. While trying to figure this out, I happened to have your workflow open while a payload came through and was able to follow the logic; however, in that case, the query did return what I would expect it to return based on the values I saw.

My theory at the moment is that there is some condition in your workflow that would cause the Mutate Node that clears the last event _not_ to run, and thus you are seeing the previous value at that payload path in your debug output. For example, you have a couple Conditional Nodes that lead into Next Nodes, which would stop that iteration. And since you are running the loop serially, changes to the payload carry over from one iteration to the next.

So, what’s happening is something like this …

1. Iteration 0 runs. In this iteration, an event is found matching your query and is placed at `working.lastEventInfo`.
2. Iteration 1 runs. Based on some conditions within that iteration, a Next Node is hit before your Mutate Node that removes the value at `working.lastEventInfo`. Therefore, the event found in Iteration 0 is still on the payload at that path.

---

<div class="post-metadata">

### Author: ![Edward\_Cline](https://avatars.discourse-cdn.com/v4/letter/e/67e7ee/32.png) [@Edward\_Cline](https://forums.losant.com/u/Edward_Cline)
#### Post date: [February 16, 2022, 6:24pm UTC](https://forums.losant.com/t/event-get-query-match-all-not-working/4355/3 "2022-02-16T18:24:32Z")

</div>

Thanks Dylan, I had assumed that there was some stale info in the payload, thus I added the mutate to clear out `lastEventInfo` on each iteration immediately before the `Event: Get` node. I don’t understand how this would not happen serially.

---

<div class="post-metadata">

### Author: ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)
#### Post date: [February 16, 2022, 7:00pm UTC](https://forums.losant.com/t/event-get-query-match-all-not-working/4355/4 "2022-02-16T19:00:12Z")

</div>

You could do one of two things:

1. Move that Mutate Node that clears the last value up to be the very first thing that runs within your Loop Node, or
2. Switch your Loop Node to run in [parallel mode](https://docs.losant.com/workflows/logic/loop/#run-loop-iterations-in-parallel), which would eliminate the need for clearing the previous value (as mutations to the payload do not carry through to subsequent iterations). You’ll also get a performance boost out of switching to parallel mode.
