How Can I Get The Data Of a Column

I want to get all data of a column.


I am trying to get this column data and get the average of this column then I’ll .text it to a text element.

Do you use DATASETs?

If NOT, then you can make a QUERY…
Something like this one…

import wixData from 'wix-data';

  wixData.query("myCollection")
  .find()
  .then( (results) => {
    if(results.items.length > 0) {
      let firstItem = results.items[0]; //see item below
    } else {
      // handle case where no matching items found
    }
  } )
  .catch( (err) => {
    let errorMsg = err;
  } );

I’ll ttry it now!

Now it’s getting the items BUT


I want to get just generalRatings and find the average of all ? How can I get just generalRatings or how can I get the result I mean average of generalRatings.

@loeix
Average = (4+4+4,5+3,3) / 4 …, right?
How you can get the total of “generalRating” ?

You can do it by a loop, or take a look at this one solution from J.D. …
https://www.wix.com/corvid/forum/community-discussion/solved-getting-sum-of-items-obtained-from-a-query

@russian-dima Someone did it for me but thanks for reply again