Get & Log All Data from Dataset

How do I get and log all information from a dataset to the console?

Hi Dustin,

To log all items from a dataset you will need to place the dataset’s getItems() function under your dataset’s onReady function.

export function dataset1_ready() {
    $w("#dataset1").getItems(0, 1000) //get items from the index 0 & total number of items 1000
    .then( (result) => {
        let items = result.items;
        console.log(items);
    });
}

Isn’t working: https://makeshark.wixsite.com/website-2/products/-Active-Fill-Control

import wixData from 'wix-data';

export function dataset1_ready() {
    $w("#reviewsDataset").getItems(0, 1000) //get items from the index 0 & total number of items 1000
    .then( (result) => {
 let items = result.items;
        console.log(items);
    });
}

@dustin you are getting the items from the ‘reviewsDataset’ but you are placing the function under the Dataset 1 onReady function.

The onReady function runs after the dataset has loaded so in order to get the items of ‘reviewsDataset’ you must place the function under the ‘reviewsDataset’ onReady function.

Also make sure you create the onReady function from the Properties Panel

1 Like

@shantanukumar847 Oh, I didn’t realize I had to add the onReady to the dataset from the properties panel. Thanks!