ERROR: 'cannot update field values: index not found'

This is driving me crazy.
So an error occurs whenever I try to run the following code:

$w("#dataset1").setFieldValue("comentario", $w("#textBox1").value).then(() => {
// ...

The error:
Uncaught (in promise) cannot update field values: index not found.

Please help me. This used to work 2 minutes before.

It seems to me that the Dataset does not have a “current item” - that is, it’s not currently pointing to a record. The dataset’s setFieldValue() applies to the current item. If there is no current item, well… you’ll get an error.

I tried to add the following line

$w(“dataset1”).setCurrentItemIndex(0);

But still it’s not working.

You’re missing the hashtag from the component ID:
$w(“#dataset1”).setCurrentItemIndex(0);

I tried it with the hashtag, but still gives me the same error.

Hi! Are you actually sure that dataset is set to “write” or “read and write”?
Can you please share page where you see the problem?

Hi! I’m so sorry I just noticed that i have the SetFieldValue for the dataset1 and then for a dynamicdataset and then again for dataset1 (here occurs the error) and that kinda ‘mixes’ them or confuses, I don’t really know. But I placed the 2 SetFieldValue lines for dataset1 first and then for the dynamicdataset.

So if you still see the problem - please share the link to the page, it’s hard to say anything without knowing actual context of the situation…

I already solved the problem I told you the solution. And thanks for effort for helping me :slight_smile: