An error occurred in one of the datasetReady callbacks type error: cannot ready property 'length' of undefined.

Hi i have an issue with the get current item. i keep getting “An error occurred in one of the datasetReady callbacks type error: cannot ready property ‘length’ of undefined.”

i have tried changing spec1.value.length to spec1.value but i still cannot get the drop down to show the options.

import wixData from 'wix-data';
$w.onReady(function () {
 //TODO: write your page related code here...
    $w("#dynamicDataset").onReady(() => {
 let spec1 = $w("#dynamicDataset").getCurrentItem().specification1;
 if (spec1.value.length > 0) {
            $w("#dropdown3").options = [
                { "label": spec1, "value": spec1 }
            ];

        }

    });
});

The following line gets the value of the field specification of the dataset’s current item.
let spec1 = $w(" #dynamicDataset ").getCurrentItem().specification1;

So, if an item was in fact returned by getCurrentItem() , then you should be able to check the length of the field value like this:
if (spec1.length > 0) {

I hope this helps,

Yisrael