# 1st arg can't be coerced to int

**URL:** <https://forum.inductiveautomation.com/t/1st-arg-cant-be-coerced-to-int/9850>\
**Category:** Ignition\
**Created:** [March 27, 2015, 4:50pm UTC](https://forum.inductiveautomation.com/t/1st-arg-cant-be-coerced-to-int/9850 "2015-03-27T16:50:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![billymac00](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@billymac00](https://forum.inductiveautomation.com/u/billymac00)\
**Post date:** [March 27, 2015, 4:50pm UTC](https://forum.inductiveautomation.com/t/1st-arg-cant-be-coerced-to-int/9850/1 "2015-03-27T16:50:12Z")

</div>

I am sure the fix is simple but I need to get past this.

I have 2 tables, and have this code in a button’s script.

data1=event.source.getComponent(“Table1a”).data  
data2=event.source.getComponent(“Table1b”).data

The complaint is at the first , but even if I swap them I get the same error.

I see data in the tables on screen fine, they are populated from SQL queries.

The file just shows the button and the 2 tables.

The lower table has first five fields integer (1b)

I can provide the console error if need be

"TypeError: getComponent(): 1st arg can’t be coerced to int "

I appreciate any help/hints

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/3d98c5b2d597f55f5d2430db29b2145fd8f569da.png)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 27, 2015, 5:01pm UTC](https://forum.inductiveautomation.com/t/1st-arg-cant-be-coerced-to-int/9850/2 "2015-03-27T17:01:22Z")

</div>

You’re pointing to the wrong reference. Meaning, it’s trying to find a table inside your button. I suppose if you squeezed it very tightly… 😉

try:

`data1=event.source.parent.getComponent("Table1a").data
data2=event.source.parent.getComponent("Table1b").data`

Also, You can use the “Insert Property Reference” button along the right-hand edge of the editor to browse to your property. That way the references are put in rightly.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 27, 2015, 5:02pm UTC](https://forum.inductiveautomation.com/t/1st-arg-cant-be-coerced-to-int/9850/3 "2015-03-27T17:02:18Z")

</div>

Oh! And welcome to the forums, btw!

---

<div class="post-metadata">

**Author:** ![billymac00](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@billymac00](https://forum.inductiveautomation.com/u/billymac00)\
**Post date:** [March 27, 2015, 5:25pm UTC](https://forum.inductiveautomation.com/t/1st-arg-cant-be-coerced-to-int/9850/4 "2015-03-27T17:25:20Z")

</div>

ok, I think I got it, missing the “.parent.” portion
