How do I get the index number of an item in a collection?

I’m trying to use setFieldValue() to populate a field in a collection. I’m trying to achieve this by identifying the index (I believe this is the same as “row” of the collection), then using setCurrentItemIndex() and then using setFieldValue().

The first hurdle is: I haven’t been able to find a way to return the index number of a field that contains a known value. For example: I know that there is one, and only one field that contains the name “john Smith” I want to know what the index number of that field is. Is there a way to do that?
Second issue I have been having is that I’m likely implementing setCurrentItemIndex() incorrectly.

the following code returns the same value for the two cosole.log commands:

let indexi = $w(‘#dataset1’).getCurrentItemIndex();
console.log("current Index ", indexi);
.then( () => {
let indexj = $w(‘#dataset1’).getCurrentItemIndex();
console.log("new Index ", indexj);

Thanks in advance for your help.