# Hide a table row/cell if it is empty

**URL:** <https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514>\
**Category:** CMS Development\
**Tags:** hubdb\
**Created:** [May 18, 2021, 3:16pm UTC](https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514 "2021-05-18T15:16:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixelilly](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pixelilly/32/70336_2.png) [@pixelilly](https://community.hubspot.com/u/pixelilly)\
**Post date:** [May 18, 2021, 3:16pm UTC](https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514/1 "2021-05-18T15:16:17Z")

</div>

Hello devs! I am trying to figure out a way to hide a hubdb table row if it’s empty. My client wants to be able to remove the dates from a webinar table. Ideally the span tag will be hidden if the date is cleared (right now if the date is cleared, it defaults to today’s date). I’ve figured out how to do this for another hubl module (eg: if button text is empty, hide button), but since this one is pulling data directly from a table that method doesn’t quite work. I have included my table loop below. I think this can be done with an if statement, but I’m pretty new to hubdb table loops, so any help will be much appreciated. Thanks! (edited to show the english version of this table)

```lia-code-sample
	{% for item in webinars %}

			<div class="col-4">
				<div class="card">
					<div class="card-thumbnail">
						<img src="{{ item.image.url }}" alt="">
					</div><!--card-thumbnail end-->
					<div class="card-info">
						<span class="date">{{ item.date|datetimeformat('%B %e, %Y') }}</span>
						<h2>{{ item.name }}</h2>
						<div class="summary">{{ item.summary }}</div>
						<a href="{{ item.link }}" title="" class="lnk-default">Agenda</a>
					</div><!--card-info end-->
				</div><!--card end-->
			</div>
			{% endfor %}
		</div>

```

---

<div class="post-metadata">

**Author:** ![jonchim](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jonchim/32/88818_2.png) [@jonchim](https://community.hubspot.com/u/jonchim)\
**Post date:** [May 19, 2021, 1:12pm UTC](https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514/2 "2021-05-19T13:12:33Z")

</div>

Hey @pixelilly,

I think If statment is definitely the way. Can you give this a shot and see if this works? 🤞

```lia-code-sample
{% if item.date %}
<span class="date">{{ item.date|datetimeformat('%B %e, %Y') }}</span>
{% endif %}

```

---

<div class="post-metadata">

**Author:** ![pixelilly](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pixelilly/32/70336_2.png) [@pixelilly](https://community.hubspot.com/u/pixelilly)\
**Post date:** [May 19, 2021, 1:40pm UTC](https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514/3 "2021-05-19T13:40:38Z")

</div>

That almost worked! It hid the date even though there was data in the table cell.

---

<div class="post-metadata">

**Author:** ![jonchim](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jonchim/32/88818_2.png) [@jonchim](https://community.hubspot.com/u/jonchim)\
**Post date:** [May 19, 2021, 1:55pm UTC](https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514/4 "2021-05-19T13:55:10Z")

</div>

Got it! can you try row.date instead of item?

---

<div class="post-metadata">

**Author:** ![pixelilly](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pixelilly/32/70336_2.png) [@pixelilly](https://community.hubspot.com/u/pixelilly)\
**Post date:** [May 19, 2021, 2:14pm UTC](https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514/5 "2021-05-19T14:14:29Z")

</div>

That also hid it. I feel like it should be if is not empty but the syntax is tripping me up.

---

<div class="post-metadata">

**Author:** ![jonchim](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jonchim/32/88818_2.png) [@jonchim](https://community.hubspot.com/u/jonchim)\
**Post date:** [May 19, 2021, 2:31pm UTC](https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514/6 "2021-05-19T14:31:11Z")

</div>

Hmm interesting, are you using the date picker in the hubdb table?

---

<div class="post-metadata">

**Author:** ![pixelilly](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pixelilly/32/70336_2.png) [@pixelilly](https://community.hubspot.com/u/pixelilly)\
**Post date:** [May 19, 2021, 2:33pm UTC](https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514/7 "2021-05-19T14:33:55Z")

</div>

Yep, I’ve included a screenshot.

 ![Screen Shot 2021-05-19 at 10.33.27 AM.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/2/2cf2edfc7b01fb8a6d51f2e7bcc215f0d45dae69.png)

---

<div class="post-metadata">

**Author:** ![jonchim](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jonchim/32/88818_2.png) [@jonchim](https://community.hubspot.com/u/jonchim)\
**Post date:** [May 19, 2021, 2:43pm UTC](https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514/8 "2021-05-19T14:43:09Z")

</div>

Wait maybe I misunderstood the initial post, do you want to hide everything if there is no date selected in HubDB? or just the date wrapped in the span?

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [May 24, 2021, 12:56pm UTC](https://community.hubspot.com/t/hide-a-table-row-cell-if-it-is-empty/37514/9 "2021-05-24T12:56:57Z")

</div>

Hi @pixelilly ,

Create Boolean option and add Somthing like this:  
{% if item.hide\_dates %}  
{{ item.date|datetimeformat(‘%B %e, %Y’) }}  
{% endif %}  
Client can easliy manange date hide show accordingly.  
Hope this helps!  
If we were able to answer your query, kindly help the community by marking it as a solution.  
Thanks and Regards.
