Get index of item in dataset

Where did you try to get the dataset index? In the code you shared you are performing a data query directly on the collection which, as you noted, would not know about the dataset index.