# How to check if a search for a table row is successful

**URL:** https://discourse.processing.org/t/how-to-check-if-a-search-for-a-table-row-is-successful/41320
**Category:** Coding Questions
**Created:** [March 16, 2023, 2:47pm UTC](https://discourse.processing.org/t/how-to-check-if-a-search-for-a-table-row-is-successful/41320 "2023-03-16T14:47:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)
#### Post date: [March 16, 2023, 2:47pm UTC](https://discourse.processing.org/t/how-to-check-if-a-search-for-a-table-row-is-successful/41320/1 "2023-03-16T14:47:23Z")

</div>

I am looking for a table row to retrieve some column values.  
The table row may or may not be there.  
How do I code to check if the ‘findRow’ is successful?  
Currrently I get an error ‘NullPointerException’ in the coding line after ‘findRow’ if the table row is not found (code attached below). Thanks for help with this.

TableRow row2=t\_02.findRow(v\_sdt,“Start date-time”);  
Float v\_steps=row2.getFloat(“Steps”);

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [March 16, 2023, 3:00pm UTC](https://discourse.processing.org/t/how-to-check-if-a-search-for-a-table-row-is-successful/41320/2 "2023-03-16T15:00:56Z")

</div>

Yeah, just check

```auto
TableRow row2=t_02.findRow(v_sdt, "Start date-time");
if (row2 != null) {
    Float v_steps=row2.getFloat("Steps");
    failed = true; 
}

```

**Remark**

when you use v\_steps later, move this section inside the if-clause also  
or evaluate `failed` to avoid errors caused by v\_steps.

v\_steps is only known inside the { } so you might want to define v\_steps before the `if(row2 != null) {..`

---

<div class="post-metadata">

### Author: ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)
#### Post date: [March 16, 2023, 3:12pm UTC](https://discourse.processing.org/t/how-to-check-if-a-search-for-a-table-row-is-successful/41320/3 "2023-03-16T15:12:37Z")

</div>

Coding resolved, thank you.
