Ok, after 6 or 7-times of reading your problem, i think i now understand what you want to do (hopefully) xD.
So, as i can see you already have the counting process.
Now you surely wants to know how to get the counting-digit into your database.
But there are still some questions.
In which column the results should be recorded?
This is an example-code of how to achieve your aim…
$w.onReady( () => {
$w("#myDataset").onReady( () => {
$w("#myDataset").getItems(0, 1))
.then( (result) => {
let items = result.items;
let totalCount = result.totalCount;
let offset = result.offset;
} )
.catch( (err) => {
let errMsg = err.message;
let errCode = err.code;
} );
} );
} );
You can use simply getItems in combination with …
$w("#myDataset").setCurrentItemIndex(variable here);
…and this one would be also be an option…
let itemObj =$w("#myDataset").getCurrentItem();
Now first try to do some brainstorming and to see the light in the dark 
I think, i am to tired to make clear thinking. I will take a look tommorow on it again.
Just in some short sentences what my idea was.
- You count UP or DOWN on your main-page —> +1/-1
- This result you could use to set the currentIemIndex of the dataset and then simply get the data out of the current selected index(row/line) of the database and then doing what ever you want with it.
- Another way could be to use…
$w("#myDataset").getItems(0, 1))
…increasing the first value with your value…
let your Value = 1 (then you increase this value for example +1)
$w("#myDataset").getItems(0, 1)) ---> should get first item
$w("#myDataset").getItems(1, 1)) ---> second item
$w("#myDataset").getItems(2, 1)) ---> third item
$w("#myDataset").getItems(3, 1)) ---> ans so on.........
$w("#myDataset").getItems(4, 1))
This would be your first step.