1

I am trying to help my church have a lending library. Currently, we have a Google sheet inserted in the Wix site. I am trying to make a better version.

The idea is to import all the books as a .csv file. There are 9 columns in this file. It imports nicely. After importing I've noticed that Wix creates 4 system generated columns. However, when I query the dataset, I get back only 9 with the 4 system generated columns in there?

Can anyone help me figure this out? I am a beginner, trying out different youtube tutorials! My knowledge of Javascript is basic and I am trying to figure out Velo!!

Is there a limit to how many columns one can have in Wix CMS or Data?

const bookLoadResult = await wixData.query('SacredShelfLibrary').limit(1).find();
        const totalRowsCount = await wixData.query("SacredShelfLibrary").count();
        console.log("totalRowsCount", totalRowsCount);

        //setting up Columns and Headers
        const fetchHeaderData = bookLoadResult.items;
        const headerData = fetchHeaderData[0];
        const numberOfColumns = Object.keys(headerData).length;
        console.log("numberOfColumns", numberOfColumns);
        const bookTableHeaders = Object.keys(headerData);
        console.log("bookTableHeaders", bookTableHeaders);

Result: enter image description here

1
  • The limit on columns is way more that the 9 + 4 that you have. Have you checked the collection to see all your fields imported properly? Can you provide what you would get if you console.log(headerData). Could it be that you're querying an items that doesn't have a value for all fields, so they aren't showing in the returned object? Commented Jun 29 at 5:43

1 Answer 1

0

Thank you Sam! Good news! Here is the result of headerData.

totalRowsCount 95

headerData {...} jsonTableCopy JSON
author: "Bob Hoskins"
_id: "9e570df9-6ea9-4760-98f1-0df76084e857"
_owner: "76001129-23f0-41da-9f3c-15b9bd2fe0e9"
_createdDate: "Wed Jun 25 2025 13:40:16 GMT+0530 (India Standard Time)"
_updatedDate: "Wed Jun 25 2025 13:40:16 GMT+0530 (India Standard Time)"
bookCopies: 1
available: true
title: "All They Want Is The Truth"
bookOwner: "BICF"

numberOfColumns 9

bookTableHeaders Array(9) jsonTableCopy JSON
0: "author"
1: "_id"
2: "_owner"
3: "_createdDate"
4: "_updatedDate"
5: "bookCopies"
6: "available"
7: "title"
8: "bookOwner"

Also, some columns are empty like you pointed out. Here's a screenshot of my Wix data table:

Preview of wixdata as it was loaded with few columns empty

So I entered "NA" in some columns. That helped. Here's the result after that:

totalRowsCount 95

headerData {...} jsonTableCopy JSON
author: "Bob Hoskins"
borrowedBy: "NA"
_id: "9e570df9-6ea9-4760-98f1-0df76084e857"
_owner: "76001129-23f0-41da-9f3c-15b9bd2fe0e9"
_createdDate: "Wed Jun 25 2025 13:40:16 GMT+0530 (India Standard Time)"
_updatedDate: "Thu Jul 03 2025 08:44:49 GMT+0530 (India Standard Time)"
requestedBy: "NA"
bookCopies: 1
available: true
title: "All They Want Is The Truth"
bookOwner: "BICF"

numberOfColumns 11

bookTableHeaders Array(11) jsonTableCopy JSON
0: "author"
1: "borrowedBy"
2: "_id"
3: "_owner"
4: "_createdDate"
5: "_updatedDate"
6: "requestedBy"
7: "bookCopies"
8: "available"
9: "title"
10: "bookOwner"

So now the non-empty columns are showing up. Thank you for your help! However 3 columns "available", "requestBook", "approve", were set as boolean. I was assuming, that leaving it empty would be taken as false. I will ask a new question about this.

Sign up to request clarification or add additional context in comments.

6 Comments

This is a 'thank you' and then a follow on question - this doesn't belong as an answer.
I'm sorry. If needed, we can close this and I can create a new question!
Booleans are not false by default. They are null or undefined. You can add a false in there manually, or set up a hook that sets the field to false when a new item is added.
Thank you... So change to a text field or still keep as a Boolean?
I would leave it as boolean, but set up a hook so that the field is false when a new item is created. If you don't know how to do that, you can add a new question and I'll help you there.
Hey Sam, thank you so much. Here's the new question: stackoverflow.com/questions/79699093/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.