# How to identify row id from data found in same row

**URL:** https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176
**Category:** Questions about Thunkable X
**Created:** [January 9, 2024, 11:45am UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176 "2024-01-09T11:45:44Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![bigbluesquidtvku](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@bigbluesquidtvku](https://community.thunkable.com/u/bigbluesquidtvku)
#### Post date: [January 9, 2024, 11:45am UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/1 "2024-01-09T11:45:44Z")

</div>

I have identified the data in a column, using a mathematical comparison to a stored variable.  
I have also initialised a variable as zero, to store the future row id.  
How do I then retrieve the correct row id to update the variable?

In the code shown, the missing block is where I think the row id would be retrieved.  
When I put the block “list of values in Wealth Data Points in Table 1 in ID” the variable returns a list of all the IDs in the table, instead of just the one matching the record found.

To match the row id to data, I would need a “if when” statement, similar to MySQL, but I can’t find the equivalent block.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/e/3ed151dc784dbed77722c1482659bca7bf6d2019.png)

---

<div class="post-metadata">

### Author: ![emlee703](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/emlee703/32/165400_2.png) [@emlee703](https://community.thunkable.com/u/emlee703)
#### Post date: [January 9, 2024, 1:19pm UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/2 "2024-01-09T13:19:16Z")

</div>

Welcome to the community, @bigbluesquidtvku!

Try looking at this link: [Data Viewer List - Thunkable Docs](https://docs.thunkable.com/~/revisions/A81b2aVlSXGVVaRtdFDr/data-viewer-list)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [January 9, 2024, 3:23pm UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/3 "2024-01-09T15:23:07Z")

</div>

See this: [Thunkable and returns a corresponding value from my sheet - #2 by tatiang](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/2)

---

<div class="post-metadata">

### Author: ![bigbluesquidtvku](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@bigbluesquidtvku](https://community.thunkable.com/u/bigbluesquidtvku)
#### Post date: [January 9, 2024, 3:25pm UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/4 "2024-01-09T15:25:29Z")

</div>

Thank you for the reply.  
The only block I can find to retrieve a row id is when an item in the Data Viewer List is clicked or swiped. Are there others that I’m missing?  
My users don’t interact with the list directly, a calculator generates a number from the user inputs and compares the result to a column of data. I then want to extract the rest of the data from the same row.

---

<div class="post-metadata">

### Author: ![mannankhanabdul](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mannankhanabdul/32/532_2.png) [@mannankhanabdul](https://community.thunkable.com/u/mannankhanabdul)
#### Post date: [January 9, 2024, 4:57pm UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/5 "2024-01-09T16:57:42Z")

</div>

![Screenshot_2024-01-09-22-21-15-569_com.android.chrome-edit](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/5/755c0dd4207d69aa661da96b1e2cdf06e7a6af45.jpeg)

Try to Implement this kind of logic to return index.

Thanks  
Abdul

---

<div class="post-metadata">

### Author: ![bigbluesquidtvku](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@bigbluesquidtvku](https://community.thunkable.com/u/bigbluesquidtvku)
#### Post date: [January 9, 2024, 5:05pm UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/6 "2024-01-09T17:05:03Z")

</div>

Thank you, this is what I tried from your example but it doesn’t read the row id, presumably because I’m not using the when… click block?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/d/7d85697eecf7184e544204eff57432728ec8a383.png)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [January 10, 2024, 12:04am UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/7 "2024-01-10T00:04:49Z")

</div>

I’m not sure if you saw my example and @mannankhanabdul’s example that both use the `find first occurrence of item` block. That’s the way to do what you’re wanting.

---

<div class="post-metadata">

### Author: ![bigbluesquidtvku](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@bigbluesquidtvku](https://community.thunkable.com/u/bigbluesquidtvku)
#### Post date: [January 10, 2024, 9:03am UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/8 "2024-01-10T09:03:50Z")

</div>

Sorry, I couldn’t get the row ID from the example. The docs say “find first/last occurrence” will return 0 or 1. As I’m using less than or equal to, there may not be an exact match.

The app variable ID below returns 0:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/8/78465be71865da9f52fe410c8316436d287cf06b.png)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [January 11, 2024, 10:15pm UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/9 "2024-01-11T22:15:20Z")

</div>

No, the `find first occurrence of item` block will return 0 if nothing is found that matches the item value but otherwise will return an integer for the first row (or list position) in which that item is found.

So for example, if you have a list {3,6,9,9,12} and you get the first occurrence of 9, the result will be 3 because the first 9 is in the 3rd position of the list. If you get the first occurrence of 12, the result will be 5 because 12 is in the 5th position in the list. If you get the first occurrence of 88, the result will be 0 because 88 doesn’t exist in the list.

The item value should **not** be a conditional (≤) unless you’re trying to match the values `true` and `false` in your list of values. But if your list of values contains integer values, for example, then you need to use an item value that is an integer. Likewise, if your list of values contains text strings, then you need to use an item value that is a text string.

Think of the `item` value as essentially a Google search of your source column. You wouldn’t typically do a Google search or search a Google Doc for “stored variable total ≤ j”.

What type of values do you have in your Upper Limit column?

---

<div class="post-metadata">

### Author: ![bigbluesquidtvku](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@bigbluesquidtvku](https://community.thunkable.com/u/bigbluesquidtvku)
#### Post date: [January 12, 2024, 5:38pm UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/10 "2024-01-12T17:38:41Z")

</div>

Thank you, that makes sense now.  
The Upper Limit column contains only integers.  
Note, in the screenshot below I’ve changed the name of app variable limits to app variable resultID.

I don’t know if it’s elegant or efficient, but it works 😃

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/5/959b1a0420c1bf5cfd4ab3a66890060f6430a260.png)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [January 12, 2024, 10:21pm UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/11 "2024-01-12T22:21:02Z")

</div>

If it works, then it’s probably fine! 😉

The only thing I notice is that you’re getting three values from the fifth row of the same data source so you could make things a little more efficient by getting the row object and storing it in a variable and then getting properties (“ID”, “Percent”, “Rank”) from that variable. But I don’t think it’s necessary to do that.

---

<div class="post-metadata">

### Author: ![bigbluesquidtvku](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@bigbluesquidtvku](https://community.thunkable.com/u/bigbluesquidtvku)
#### Post date: [January 13, 2024, 9:24am UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/12 "2024-01-13T09:24:36Z")

</div>

Just as a reference for future readers, these are the final code blocks that worked, with the variables in place of the number 5:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/7/e7fe99a9a1d82503c5c79f28f20845af5737f938.png)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)
#### Post date: [April 12, 2024, 9:25am UTC](https://community.thunkable.com/t/how-to-identify-row-id-from-data-found-in-same-row/2773176/13 "2024-04-12T09:25:35Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
