<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Editing a Table Using Blocks]]></title><description><![CDATA[<h2><a class="anchor-offset" name="prerequisite"></a>Prerequisite</h2>
<ul>
<li><a href="/topic/74/introduction-to-tables">Introduction to Tables</a></li>
</ul>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="description"></a>Description</h2>
<p dir="auto">You can easily edit a table using blocks, such as adding new rows, removing some rows, or changing the value of some items.</p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="appending-a-new-row"></a>Appending a New Row</h2>
<p dir="auto">The “add to table” block <strong>appends a new row at the bottom of a table</strong>, then set the values of some or all of the items. It can take up to 12 values, so you can at most set the values of the <strong>first 12 items in the new row</strong> using this block.</p>
<p dir="auto">Note that the order of the values has to match the column order in the table. Blank input boxes will be ignored.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b3919874-73ce-40a4-b95c-c8cdeacf9adc.gif" width="1000" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="inserting-a-new-row"></a>Inserting a New Row</h2>
<p dir="auto">You can also insert a new row at a particular row number. The existing rows will be pushed down to make room for this new row. You can specify at most the first 12 items in this new row:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/0b084555-a691-4d71-8dd3-23943664518c.gif" width="990" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="replacing-a-row"></a>Replacing a Row</h2>
<p dir="auto">You can replace all items in a row using the block below if you know its row number. Other rows will not be affected.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/186391df-183b-4604-8238-7c0be2632d76.gif" width="980" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="replacing-one-item"></a>Replacing One Item</h2>
<p dir="auto">Sometimes you only need to change one item, and keep the other items in the row unchanged. If you know that item’s row number and column name, then you can change its value using this block:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ea7b4430-d067-4e77-89fe-118a2be82846.gif" width="880" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
Note that for the second input, <span style="color:#f40b0b">you have to specify the column name (e.g. “age”), not the column index (e.g. 2)</span>. This is a very common mistake.</p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="changing-an-item-relatively"></a>Changing an Item Relatively</h2>
<p dir="auto">For some use cases, you only want to change an item relatively based on its current value. For example, if someone’s birthday has just passed, you might want to increase his age by 1. Similarly, if someone has lost a game, you can reduce his points by some number. The following 2 blocks can be used to change or reduce an item’s value:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/490250a0-2e07-450a-892f-a04140e6ca57.gif" width="880" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="deleting-a-row-by-row-number"></a>Deleting a Row by Row Number</h2>
<p dir="auto">If you know the row number of any row you would like to delete, you can use the following block to delete that row. The rows below will move up by one row to fill in the gap.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/a1687448-aad7-447d-93bf-cc822f2af4cd.gif" width="600" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="deleting-all-rows"></a>Deleting All Rows</h2>
<p dir="auto">You can also clear the table and delete all rows. The column structure will not change:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/8dc040d5-e639-4786-a6dd-3ee18132d493.gif" width="550" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="deleting-rows-by-matching-value-in-a-column"></a>Deleting Rows by Matching Value in a Column</h2>
<p dir="auto">Sometimes we only want to delete all rows in the table with a specific value in a specific column. You can use the following block to specify the column and the value to look for in that column.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/32a4c099-d18b-40d7-bfd3-8d7088a9ef6b.gif" width="700" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="inserting-a-new-column"></a>Inserting a New Column</h2>
<p dir="auto">You can also insert a new empty column into a table. You need to specify the name and position of this new column. The existing columns at that position and after will all be pushed to the right by one column.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/7681406b-b8d2-4ceb-82b7-b6a48640e0b8.gif" width="1000" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto">Note that this is an uncommon operation, since normally a table’s structure is fixed, and we just change its rows or items.</p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="deleting-a-column"></a>Deleting a Column</h2>
<p dir="auto">You can also remove an entire column from a table by specifying the column name, and the letter case of the name does not matter.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/229bb47a-7f50-4042-a88f-377e07d962bc.gif" width="900" /></p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="deleting-all-columns"></a>Deleting All Columns</h2>
<p dir="auto">If you need to redefine a table, you can delete all its columns, then add new columns to it from scratch.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/c2046bec-2e11-4695-a2a9-7d7ea74a83e7.gif" width="840" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="show-or-hide-the-table"></a>Show or Hide the Table</h2>
<p dir="auto">You can use the following 2 blocks to show or hide the table on the stage:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/c400d0be-86aa-4f56-b1ee-2f4eddb3e1c6.png" alt="70ce42df-d7f5-4f35-9bea-72d7321a6e26-image.png" class=" img-responsive img-markdown" width="513" height="98" /></p>
<p dir="auto"> <br />
For example:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/3cb3c686-3f38-4a76-b93a-54f05a897331.gif" alt="tb.gif" class=" img-responsive img-markdown" width="536" height="245" /></p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="learn-more"></a>Learn More</h2>
<ul>
<li><a href>Reading from a List</a></li>
</ul>
]]></description><link>https://forum.creaticode.com/topic/438/editing-a-table-using-blocks</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 15:44:55 GMT</lastBuildDate><atom:link href="https://forum.creaticode.com/topic/438.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 11 Aug 2022 00:49:10 GMT</pubDate><ttl>60</ttl></channel></rss>