# Update table column with button press

**URL:** <https://forum.inductiveautomation.com/t/update-table-column-with-button-press/78733>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [September 4, 2023, 7:47pm UTC](https://forum.inductiveautomation.com/t/update-table-column-with-button-press/78733 "2023-09-04T19:47:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zayne\_Luker](https://avatars.discourse-cdn.com/v4/letter/z/74df32/32.png) [@Zayne\_Luker](https://forum.inductiveautomation.com/u/Zayne_Luker)\
**Post date:** [September 4, 2023, 7:47pm UTC](https://forum.inductiveautomation.com/t/update-table-column-with-button-press/78733/1 "2023-09-04T19:47:55Z")

</div>

Hello All,

I am still learning about Ignition and am having trouble with the table component in vision. I found that it is not easy to copy and paste down an entire column similar to how one would in Microsoft Excel. I was wondering if there is a script that could update every row in a column by using a button press. In my case I would like to update my column labeled, 'Date'. With this button press I would like to display the current date in the format "M/d/yyyy" with a timestamp of "00:00:00". Is there anyway this could be done? I appreciate any help!

Thanks

![ign_forum](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/2/a239239d9f3474a527e7439b874bb8a18180831e.png)

---

<div class="post-metadata">

**Author:** ![Zayne\_Luker](https://avatars.discourse-cdn.com/v4/letter/z/74df32/32.png) [@Zayne\_Luker](https://forum.inductiveautomation.com/u/Zayne_Luker)\
**Post date:** [September 6, 2023, 8:44pm UTC](https://forum.inductiveautomation.com/t/update-table-column-with-button-press/78733/2 "2023-09-06T20:44:05Z")

</div>

I found a solution that works for my scenario although it does not use a button press. First I created a **Memory Tag** with the name, _CurrentDateMidnight_ with the **datatype as DateTime**.

 ![Tag_Setup](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/6/e645b49a78b0d2e6d8343cfb5ac522a1f874573e.png)

Next, I went to Projects\>Gateway Events\>Scheduled and created a script that writes the current date and timestamp to the **CurrentDateMidnight** tag made in the previous step. I set up the Schedule to run at 12:00 AM everyday. The write function uses the **CurrentDateMidnight** tag and writes the value using the system.date.now() function.

 ![Script_Schedule](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/6/c6407e2efd77e0af49358c133314b690ed0e3231.png)  
 ![Script](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/7/a724012d7ffe20d91daee0d4dd2d98ecc5433016.png)

From here I went back to my table and preformed a **Cell Update** Property Binding to the Data property of the Table. After specifying my rows and column I added the **CurrentDateMidnight** tag to the value section.

 ![Cell_Update](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/0/906f6e1ebc91d30a3142089f8458729ab24ec5c5.png)

Whenever this scheduled event executes it writes the current date as well as the timestamp it executed. In my case it prints, "mm/dd/yyyy 00:00:00". Depending on the time the scheduled event is planned to execute will determine the timestamp.

---

<div class="post-metadata">

**Author:** ![amy.sudibyo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amy.sudibyo/32/38659_2.png) [@amy.sudibyo](https://forum.inductiveautomation.com/u/amy.sudibyo)\
**Post date:** [September 7, 2023, 3:20am UTC](https://forum.inductiveautomation.com/t/update-table-column-with-button-press/78733/3 "2023-09-07T03:20:13Z")

</div>

FYI, you could make your tag an expression tag with the expression `midnight(now())`. No need to have a gateway script.

---

<div class="post-metadata">

**Author:** ![Zayne\_Luker](https://avatars.discourse-cdn.com/v4/letter/z/74df32/32.png) [@Zayne\_Luker](https://forum.inductiveautomation.com/u/Zayne_Luker)\
**Post date:** [September 7, 2023, 12:23pm UTC](https://forum.inductiveautomation.com/t/update-table-column-with-button-press/78733/4 "2023-09-07T12:23:22Z")

</div>

Thanks for the reply! Still very new to SCADA and often find myself reinventing the wheel. I like this better and will use this from now on.
