# patch.onResponse() question

**URL:** <https://forum.electra.one/t/patch-onresponse-question/1093>\
**Category:** General discussion\
**Created:** [November 15, 2021, 3:06pm UTC](https://forum.electra.one/t/patch-onresponse-question/1093 "2021-11-15T15:06:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldgearguy](https://avatars.discourse-cdn.com/v4/letter/o/f4b2a3/32.png) [@oldgearguy](https://forum.electra.one/u/oldgearguy)\
**Post date:** [November 15, 2021, 3:06pm UTC](https://forum.electra.one/t/patch-onresponse-question/1093/1 "2021-11-15T15:06:27Z")

</div>

Parts of the documentation imply that you can have more than one onResponse() to an incoming patch and the responseId parameter will match based on the byte string defined in the JSON.

But, I don’t see a way to actually declare separate patch.onResponse() methods in a LUA script.

I do see that in theory if I define a

```auto
"patch": [{ "responses": [{ "id": 1, "header": [0, 0, 0x0E, 0x22, 1, 4], "rules": [] }] }]

```

with multiple id and byte strings in the device JSON I can get the incoming data routed to a patchResponse() and then inside that single method branch to different handlers based on the responseId.

Is that the accepted way of dealing with (for example) a request/response for a single patch and a request/response for an entire bank? The headers for the request and response will differ, so they will be distinct (the bank is not simply a series of complete single patch sysex dumps)

---

<div class="post-metadata">

**Author:** ![Flyweight](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/flyweight/32/342_2.png) [@Flyweight](https://forum.electra.one/u/Flyweight)\
**Post date:** [November 15, 2021, 5:43pm UTC](https://forum.electra.one/t/patch-onresponse-question/1093/2 "2021-11-15T17:43:10Z")

</div>

Can’t you work with a single patch.onResponse() function?

Then differentiate your parsing rules by using the ``responseId``` ?

I think it intended like that but I am guessing here.

---

<div class="post-metadata">

**Author:** ![oldgearguy](https://avatars.discourse-cdn.com/v4/letter/o/f4b2a3/32.png) [@oldgearguy](https://forum.electra.one/u/oldgearguy)\
**Post date:** [November 15, 2021, 6:00pm UTC](https://forum.electra.one/t/patch-onresponse-question/1093/3 "2021-11-15T18:00:14Z")

</div>

that’s what I’m going to do, but was curious based on what was documented.
