# Advanced Logic/Javascript on a matrix field

**URL:** https://community.feathery.io/t/advanced-logic-javascript-on-a-matrix-field/591
**Category:** Support
**Created:** [April 7, 2024, 1:15am UTC](https://community.feathery.io/t/advanced-logic-javascript-on-a-matrix-field/591 "2024-04-07T01:15:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![KrisB](https://avatars.discourse-cdn.com/v4/letter/k/b2d939/32.png) [@KrisB](https://community.feathery.io/u/KrisB)
#### Post date: [April 7, 2024, 1:15am UTC](https://community.feathery.io/t/advanced-logic-javascript-on-a-matrix-field/591/1 "2024-04-07T01:15:55Z")

</div>

I have a matrix field with 3 rows and 4 columns. I’d like to run some custom logic (via Javascript) on that field, but unsure how to do so.

I usually use the Rule Builder to give me some direction (and see what JS code it writes), but that tool is only allowing me to select from [“is filled”; “is empty”].

Would love some example JS code that details, for example, if for Row2 the user selected Option/Column 3.

Thx

---

<div class="post-metadata">

### Author: ![summep](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@summep](https://community.feathery.io/u/summep)
#### Post date: [April 7, 2024, 5:24am UTC](https://community.feathery.io/t/advanced-logic-javascript-on-a-matrix-field/591/2 "2024-04-07T05:24:05Z")

</div>

Hi Kris, I have added a logic rule `Matrix Example` in the `Stock Comp Assessment` form as a reference - you would first need to obtain the question id for each of the rows (already included in the code comments), and use that to check if a certain option is selected with `includes()`.

Please let us know if this works for what you would like to achieve. Thank you.
