# Show Component Always

**URL:** <https://community.glideapps.com/t/show-component-always/42712>\
**Category:** Feature Requests\
**Created:** [June 3, 2022, 6:10pm UTC](https://community.glideapps.com/t/show-component-always/42712 "2022-06-03T18:10:00Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![rleinen](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/rleinen/32/43270_2.png) [@rleinen](https://community.glideapps.com/u/rleinen)\
**Post date:** [June 3, 2022, 6:10pm UTC](https://community.glideapps.com/t/show-component-always/42712/1 "2022-06-03T18:10:00Z")

</div>

For all components please allow an option to have the component appear even if there is no data in the field. The UI changes depending on what data has or has not been entered, which makes it harder to make consistent screens. And also, when viewing, the user may not know which fields are missing data simply because they do not appear. But it would be good to see something like this to show that some data is expected but not entered.

Status:  
(empty space)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [June 3, 2022, 10:16pm UTC](https://community.glideapps.com/t/show-component-always/42712/2 "2022-06-03T22:16:00Z")

</div>

An alternative would be to remove headings from all of your components, but instead use text or rich text components as your headings.

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [June 3, 2022, 11:44pm UTC](https://community.glideapps.com/t/show-component-always/42712/3 "2022-06-03T23:44:44Z")

</div>

Another alternative would be to initiate you data points.

Let’s take “phone number” as an example. It could be anything else you expect your users to submit.

You can create 3 columns:

- Phone\_No\_Initiate (or Phone\_No\_Default): a template column or a single value column, whose value will be non-empty for each new row. For example – or - .
- Phone\_No\_Submit: basic column whose value is submit by the user.
- Phone\_No\_Display: an if-then-else column to display Phone\_No\_Initiate if Phone\_No\_Submit is empty, else Phone\_No\_Submit.

With these 3 columns – initiate, submit, display – you can make sure a default value or a submitted value are always displayed.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [June 4, 2022, 3:30am UTC](https://community.glideapps.com/t/show-component-always/42712/4 "2022-06-04T03:30:19Z")

</div>

> [@nathanaelb](#):
>
> Phone\_No\_Initiate (or Phone\_No\_Default): a template column or a single value column, whose value will be non-empty for each new row. For example – or - .

This column is actually redundant. You could just use a single if-then-else column, ie:

- If Phone Number is empty, then ‘-’
- Else Phone Number

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [June 4, 2022, 11:45am UTC](https://community.glideapps.com/t/show-component-always/42712/5 "2022-06-04T11:45:58Z")

</div>

Totally agree, three columns could be reduced to two, but I prefer not to. I use this method quite often, mainly for user-submitted data that’s not required, including images. For images, I’ll use the “Generate Image” column (only if the list is short, because the experience may become sluggish if the list is too long) or a single value column with a URL.

Reasons why I always use three columns even though I could simplify:

- I use three columns for images and I prefer being consistent with my methods. If I do it for images, I’ll do it for other data types as well.
- I like seeing my data in tables. That way I might remember it’s there. I would feel uncomfortable if default data were “hidden” in a field of a ITE column. But maybe that’s just me 😅

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [June 4, 2022, 12:04pm UTC](https://community.glideapps.com/t/show-component-always/42712/6 "2022-06-04T12:04:16Z")

</div>

> [@nathanaelb](#):
>
> I like seeing my data in tables. That way I might remember it’s there. I would feel uncomfortable if default data were “hidden” in a field of a ITE column. But maybe that’s just me

This is a good point. And it’s similar to the mantra of avoiding [Magic Numbers](https://www.codebyamir.com/blog/software-anti-patterns-magic-numbers) in programming.

Personally I think it’s okay for this specific use case, but I totally get your approach and don’t disagree with it.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [June 4, 2022, 2:34pm UTC](https://community.glideapps.com/t/show-component-always/42712/7 "2022-06-04T14:34:01Z")

</div>

Hm…good insight on magic numbers. Apparently I use magic numbers all the time…might need to rethink my methods.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [June 4, 2022, 2:49pm UTC](https://community.glideapps.com/t/show-component-always/42712/8 "2022-06-04T14:49:42Z")

</div>

hehe yeah, I’ve picked up on that in some of your videos but didn’t say anything 🙂

I think with Glide, it’s probably a matter of striking a balance between avoiding it and winding up with an excessive amount of columns.

But when it comes to coding, I try to be a bit disciplined about it. For example, when I’m writing Apps Script for a project I’ll usually have a separate `constants.gs` file that contains declarations for all my global variables, including any “magic numbers”. So I might have stuff that looks like this:

```auto
// Magic Numbers
const SCREENINGS_RESTART_THRESHOLD = 10; // Minutes
const GANG_LIST_BUFFER_DAYS = 14;
const ROSTER_BUFFER_MONTHS = 6;

```

It takes some discipline, but pays dividends when you come back to the code several months later and try to debug something.

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [June 4, 2022, 10:19pm UTC](https://community.glideapps.com/t/show-component-always/42712/9 "2022-06-04T22:19:16Z")

</div>

I like that concept a lot! I’m no programmer I had never heard of magic numbers before, but we do see them quite a bit.

Do you consider the +15 or +15+30 from the first day of the month to be a magic number? The first time I saw Jeff’s method, I found the approach both really smart and uncomfortable: 15 is somewhat arbitrary I feel, any number between 1 and 27 would work fine really, but 15 feels far enough from the edges : )

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [June 5, 2022, 12:56am UTC](https://community.glideapps.com/t/show-component-always/42712/10 "2022-06-05T00:56:24Z")

</div>

Hehe. It’s like the “answer to everything”…I should have went with 42 instead. 😉 The reason I went with 15, is that it puts you approximately in the middle of the month, so when you add months or years based on the average number of days in a month, it would keep you somewhere in the middle of the resulting month. I just wanted to allow enough wiggle room since the math could add a day or two before or after the middle of the month. Adding 30 days to the first or last day of a month can give you inaccurate results since months can have a varying number of days. I think some earlier versions of my formula weren’t quite as accurate, but the latest version is pretty solid I think.

Yeah it is a bit arbitrary to use 15. It’s less of a magic number, and more of a throw spaghetti at the wall and see what sticks. The formula is not easy to understand, but I like the challenge of throwing everything into a single math column…even some semblance of IF logic, using creative math. Breaking it down into multiple columns would definitely make it easier to understand several years from now.

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [June 5, 2022, 7:37am UTC](https://community.glideapps.com/t/show-component-always/42712/11 "2022-06-05T07:37:30Z")

</div>

I find the formula and thinking behind it incredibly smart, don’t get me wrong. I was just wondering if we could put that +15 in the magic number category : )

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [June 5, 2022, 8:11am UTC](https://community.glideapps.com/t/show-component-always/42712/12 "2022-06-05T08:11:52Z")

</div>

> [@nathanaelb](#):
>
> Do you consider the +15 or +15+30 from the first day of the month to be a magic number? The first time I saw Jeff’s method, I found the approach both really smart and uncomfortable: 15 is somewhat arbitrary I feel, any number between 1 and 27 would work fine really, but 15 feels far enough from the edges : )

I’ve been thinking about this all day, and I don’t really have a good answer. I’m inclined to say no, but I don’t know how well I can explain why. I suppose, you could extract the 15 from the formula and put that in its own column, but what do you call it? `Magic 15`? That wouldn’t be very helpful.

In this case, I think what is way more important is how you name the column that it’s used in. In any Math column where you use a complex formula, you better make damned sure that the name of the column makes it absolutely clear what the purpose of it is. Throw one of Jeff’s date formulas in a math column and call it `Date2` or `New Column 7`, and you deserve what you get 😛 (and you could probably call that a “Magic Column” 🤣 )

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [June 5, 2022, 10:07am UTC](https://community.glideapps.com/t/show-component-always/42712/13 "2022-06-05T10:07:40Z")

</div>

Right?! +15 fits in the formula perfectly, it’s bring us to the “middle” of just about any month, 15 is so much prettier than 14 or 16. But then, 15 is so arbitrary. Your column would be called “Middle\_of\_Month\_Increment”, but then the column would just contribute to column bloat, and really the fewer columns the better in my view : )

---

<div class="post-metadata">

**Author:** ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)\
**Post date:** [June 5, 2022, 12:22pm UTC](https://community.glideapps.com/t/show-component-always/42712/14 "2022-06-05T12:22:10Z")

</div>

@Jeff_Hager Context on the Magic ‘15’ please. Can you reference where this approach is? I always like seeing other approaches. Especially date related things.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [June 5, 2022, 12:25pm UTC](https://community.glideapps.com/t/show-component-always/42712/15 "2022-06-05T12:25:43Z")

</div>

Maybe this one…

> [@Find the last day of the following month](https://community.glideapps.com/t/find-the-last-day-of-the-following-month/21557/13):
>
> So, I’ll explain the logic a little bit. My main goal was to try to get the 1st day of the month, but two months from now. So for example, today is January 22nd. My goal was to figure out March 1st, and then simply subtract 1 day to get the last day of the previous month. If you look at the formula, I am first taking today’s date, and subtracting the number of days from that same date. Technically that gives me December 31st as a result, but then I add 15 days. The reason I add 15 days is…

Actually, from the same thread… I think this was the very first time ~~Jeff~~ [Chuck](https://community.glideapps.com/t/chuck-norris-aka-jeff/26818) unleashed the magic 15. I’ll never forget it. He did in one column what had taken me more than 40 columns 🤣

> [@Find the last day of the following month](https://community.glideapps.com/t/find-the-last-day-of-the-following-month/21557/7):
>
> @Darren_Murphy how about 1 column? Hold my beer ((Now-DAY(Now)+15)+60) - DAY((Now-DAY(Now)+15)+60)

And, if you like date related stuff, have a browse through this thread…

> [@Fun with Dates](https://community.glideapps.com/t/fun-with-dates/21684):
>
> I just remembered something from a long time ago. I don’t remember if I had posted about it in this forum or in the old spectrum forum. Can’t find the post in either forum right now. Working on these posts re-triggered this memory. What I had discovered back then is how ridiculously forgiving the calendar layout is. It can take dates in a variety of formats and still determine the correct date to show. But the really cool thing I had discovered is that you can feed it certain types of te…

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [June 5, 2022, 12:54pm UTC](https://community.glideapps.com/t/show-component-always/42712/16 "2022-06-05T12:54:46Z")

</div>

I think this is the latest iteration of the formula to add months to a date, which handles leap year or end of month situations.

> [@If then else with DATE](https://community.glideapps.com/t/if-then-else-with-date/11328/23):
>
> @Darren_Murphy @Milan_Balogh Geez, I had to put on my thinking cap before my morning coffee. The same place that Darren got that original formula had a second formula. It looks like that old thread is unlisted now, so I won’t link to it, but the second formula dealt with adding years, and also accounted for leap year, so if you added 1 year to Feb 29th, then the next year if would calculated to Feb 28th instead of March 1st. Essentially it would figure out if the month of the future calculate…

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [June 5, 2022, 2:00pm UTC](https://community.glideapps.com/t/show-component-always/42712/17 "2022-06-05T14:00:01Z")

</div>

I think one thing to consider with magic numbers is, could they ever change. Consider a tax rate, for example. Sure, you could just make tax part of a formula to add a certain percentage of tax to a total, but that’s a number that could potentially change every few years. On the other hand, it pretty safe to say that the number of days in a month won’t change in any of our lifetimes.

Another consideration is how often that number is used throughout an app. If the number is used in several places, then it probably makes sense to have it as a global variable. Then in the event that you ever need to change that number, you only need to change it in one place.

It’s a matter of how easy you can make it to find and change a number in the event that you ever need to in the future. Whether it’s well labeled variables, or very thorough documentation.

Think of how glide uses CSS. They most likely have a master CSS stylesheet that controls the CSS for all apps. Whenever they want to make a change to how a component looks, they only have to change it in one place and every single one of our apps is automatically updated. On the other hand, when one of us chooses to add CSS which overrides the CSS from that master stylesheet, then it only affects one screen in one app. Magic numbers are really the same. They can either be a global defined variable, or they can be super specific to one little section of a function or formula.

In the code world, documentation is key. Whether it’s naming variables in a way that tells the developer their type and purpose…or simply adding comments to your code which describes what a function does and how it works. A lot of times you need to consider that someone else will have to look at that code and make sense of it years in the future.

At my day job, I work as a developer. There are some wicked math formulas that we deal with, that are provided by the government. Some of it uses lookup tables with millions of records to get specific variables for math formulas, some of it uses static numbers that never change, and some of it uses global variables that are used in multiple calculations. It’s kind of all over the place, but in most cases everything is well documented so we can match up the code to the specs when needed. Through the years, a lot of our code has been updated to use table driven variables, so it’s a lot easier bto make the code run differently by changing some values in a table. The most frustrating part though, is when I’m looking into a bug, but I run across code that was added 10 years ago with little to no documentation. I end up spending a lot of time trying to figure out what the code is supposed to be doing, so I can then figure out how to fix it. It can be very time consuming.

In the end, just make sure you can look at something several years from now and easily understand what it’s doing so you can maintain it if necessary.

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [June 6, 2022, 11:00pm UTC](https://community.glideapps.com/t/show-component-always/42712/18 "2022-06-06T23:00:45Z")

</div>

To decide whether to give the number its own cell or column in a table, I like Jeff’s recommendation that it depends on whether the number might change and how often it is used throughout the app.

Like you Darren, I’ve been thinking about this a little, and I’ve come to the conclusion that 15 is not a magic number, but a constant of nature just like pi or e 😉 This constant represents the middle of a month or half a month, so we can happily name this constant hm. This conveniently also refers to her majesty. So hm is not a magic number 🙂
