getCurrentItemIndex()?

Hi everyone,
I have a table on one of my pages that is connected to a database. Each row represents an item in the database. I am trying to get it so that I can get the index/id of the item in the database when a row is selected. I use the $w(“#database”).getCurrentItemIndex() inside the rowSelect function of the table and the index I get is the index of the item on the table not database. I would appreciate any help.

You need to access the item on scope with the event and then get the itwm

Great! How do I do that?

So here is what I got! This code gives me an item id from the table’s items, but for some reason the ids are not representing the correct item. For example when I select the first row it gives me the id for the second row item. It seem like my indexes get mixed up at some point? I would really appreciate any help!
export function reqTable_rowSelect(event) {
//Add your code for this event here:
let scope = $ w.at (event.context.itemId);
let item = scope(’ #dataset2 ').getCurrentItem();
let itemId = item._id; console.log(itemId);
}