How to identify row id from data found in same row

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.

Welcome to the community, @bigbluesquidtvku!

Try looking at this link: Data Viewer List - Thunkable Docs

See this: Thunkable and returns a corresponding value from my sheet - #2 by tatiang

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.

Try to Implement this kind of logic to return index.

Thanks
Abdul

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?

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.

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:

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?

1 Like

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 :smiley:

If it works, then it’s probably fine! :wink:

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.

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

1 Like

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