# Filling one table from two sources

**URL:** <https://forum.wixstudio.com/t/filling-one-table-from-two-sources/12067>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [December 18, 2018, 12:26pm UTC](https://forum.wixstudio.com/t/filling-one-table-from-two-sources/12067 "2018-12-18T12:26:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![naomie](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/naomie/32/669_2.png) [@naomie](https://forum.wixstudio.com/u/naomie)\
**Post date:** [December 18, 2018, 12:26pm UTC](https://forum.wixstudio.com/t/filling-one-table-from-two-sources/12067/1 "2018-12-18T12:26:04Z")

</div>

Hi,

I created a table which is populated by an external API.

One of the columns is empty because there is no value in the external API associated with it.

How can I set the value of this whole column to one word - “edit”?

Thanks!

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [December 18, 2018, 1:14pm UTC](https://forum.wixstudio.com/t/filling-one-table-from-two-sources/12067/2 "2018-12-18T13:14:01Z")

</div>

When you have the data from your API you can set that to the table and then you can modify that data using the columns and rows property of the table.

> **[Table - Velo API Reference - Wix.com](https://www.wix.com/velo/reference/$w/table)**
>
> A Table for displaying data.

---

<div class="post-metadata">

**Author:** ![naomie](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/naomie/32/669_2.png) [@naomie](https://forum.wixstudio.com/u/naomie)\
**Post date:** [December 18, 2018, 2:52pm UTC](https://forum.wixstudio.com/t/filling-one-table-from-two-sources/12067/3 "2018-12-18T14:52:02Z")

</div>

Thanks Andreas.

I was unable to figure out how to set the data of one column using the documentation available. Do you know how I would do this?

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [December 18, 2018, 3:07pm UTC](https://forum.wixstudio.com/t/filling-one-table-from-two-sources/12067/4 "2018-12-18T15:07:39Z")

</div>

@naomie Hey  
Here is some sample from the docs. At the end you see that they add to a column. They set the column id as download and then loop through and set the value of that column.

```javascript
import wixData from 'wix-data';

$w.onReady( function () {

  // set the table columns
  $w("#myTable").columns = [
    // the column that shows the document name
    {
      "id": "col1",
      "dataPath": "docName", // matches field key from collection
      "label": "Name",
      "width": 100,
      "visible": true,
      "type": "string",
    },
    // the column that shows the document description
    {
      "id": "col2",
      "dataPath": "docDescription", // matches field key from collection
      "label": "Description",
      "width": 100,
      "visible": true,
      "type": "string",
    },
    // the column for downloading the document
    {
      "id": "col3",
      "dataPath": "download", // does not match field key from collection
      "label": "Download",
      "width": 100,
      "visible": true,
      "type": "richText",
      "linkPath": "doc" // matches field key from collection
    }
  ];

  // execute query
  wixData.query("myCollection")
    .find()
    .then((results) => {
      // get the query result items
      let tableRows = results.items;

      // add a property and value to serve as link text
      // property key matches third column dataPath above
      tableRows.forEach( (row) => {
        row.download = '<span style="color:blue">Download the doc</span>';
      } );

      // set the table row data
      $w("#myTable").rows = tableRows;
    } );

} );

```
