Array to string error when trying to popluate a table

I’m trying to query for records in the database and display them in a table. I though I set everything up correctly, but I’m getting an error. Anyone know how to correct it?

Hi Keith,

Did you use custom query to build your query? Perhaps there is something wrong with your query?

Also did you use the table generator to build your table?

Hi @brad, I used the table generator for the table. I used the Query Builder for the query.

Here’s my table code.

 <table class="table">
        <thead>
          <tr>
            <th>Id</th>
            <th>Name</th>
            <th>Type</th>
            <th>Folder size</th>
            <th>Notes</th>
            <th>Deadline</th>
            <th>Account</th>
            <th>Active</th>
          </tr>
        </thead>
        <tbody is="dmx-repeat" dmx-generator="bs4table" dmx-bind:repeat="getProjects.data.getAccountProjects" id="tableRepeat1">
          <tr>
            <td dmx-text="id"></td>
            <td dmx-text="name"></td>
            <td dmx-text="type"></td>
            <td dmx-text="folder_size"></td>
            <td dmx-text="notes"></td>
            <td dmx-text="deadline"></td>
            <td dmx-text="account_id"></td>
            <td dmx-text="active"></td>
          </tr>
        </tbody>
      </table>

Here’s my query statement.
image

I’m guessing the table doesn’t populate in design view as you are using a variable. If you replace the variable with a known variable in your server connect does the table display properly in Wappler design view?

Your code looks fine to me.

OK, replace the variable with a static AccountID works. I guess there’s something wrong with the previous query to get the AccountID.

Yes, to me it points to an error in how you are generating that accountID variable.

Got it! I needed to use a “Database Single Query” instead of a “Database Query”.

Thanks for the help @brad! :slight_smile:

1 Like

Great! Glad it is sorted out.