# Pop value from table

**URL:** <https://discourse.slicer.org/t/pop-value-from-table/11530>\
**Category:** Development\
**Created:** [May 13, 2020, 9:16pm UTC](https://discourse.slicer.org/t/pop-value-from-table/11530 "2020-05-13T21:16:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaoloZaffino](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/paolozaffino/32/81052_2.png) [@PaoloZaffino](https://discourse.slicer.org/u/PaoloZaffino)\
**Post date:** [May 13, 2020, 9:16pm UTC](https://discourse.slicer.org/t/pop-value-from-table/11530/1 "2020-05-13T21:16:19Z")

</div>

Hi all,  
I havev a question about table.  
I have a table with two columns and I want to pop the last value, shift all the elements and insert a new value just for a single column.  
Basically I need to have always the same number of rows, but I want to add a new value and removing the last one.  
Which is the most efficient way to do this?

Thanks a lot!  
Paolo

---

<div class="post-metadata">

**Author:** ![Davide\_Punzo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/davide_punzo/32/66104_2.png) [@Davide\_Punzo](https://discourse.slicer.org/u/Davide_Punzo)\
**Post date:** [May 14, 2020, 2:49pm UTC](https://discourse.slicer.org/t/pop-value-from-table/11530/2 "2020-05-14T14:49:59Z")

</div>

The columns of a table are vtk arrays.

For example, in the documentation [https://www.slicer.org/wiki/Documentation/Nightly/Developers/Plots](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Plots) are vtkFloatArray.

The vtk arrays should have an InsertTuple method, which should insert the new value at a certain index, see ([https://vtk.org/doc/nightly/html/classvtkDataArray.html#a00d044d0893988ffc753e86fc5247ba8](https://vtk.org/doc/nightly/html/classvtkDataArray.html#a00d044d0893988ffc753e86fc5247ba8) [https://vtk.org/doc/nightly/html/classvtkDataArray.html#af545503feb6c030a851f824d937e9869](https://vtk.org/doc/nightly/html/classvtkDataArray.html#af545503feb6c030a851f824d937e9869)).

For removing the last value, you can use the Resize method.

P.S.: you get the column with the method GetColumn from table = tableNode.GetTable(). After modifying the vtk array, for updating the table and plot, you need to call table.Modify().
