# Question regarding the "ifEmpty" function

**URL:** <https://community.weweb.io/t/question-regarding-the-ifempty-function/3635>\
**Category:** How do I?\
**Created:** [July 21, 2023, 7:37pm UTC](https://community.weweb.io/t/question-regarding-the-ifempty-function/3635 "2023-07-21T19:37:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandon](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/brandon/32/2804_2.png) [@brandon](https://community.weweb.io/u/brandon)\
**Post date:** [July 21, 2023, 7:37pm UTC](https://community.weweb.io/t/question-regarding-the-ifempty-function/3635/1 "2023-07-21T19:37:08Z")

</div>

So let’s say I’ve got a page where at the top I want it to say “Searching Everyone”. If, however, the user enters a name into the search bar (let’s say “Doug”) I want the title to change to “Searching People Named Doug”)

I know there are roundabout ways to accomplish this by building out additional variables, but I’d really like to avoid that and just accomplish it purely through a formula. Is this possible?

The ifEmpty function is the closest, but the issue is I can’t prepend text to the value. Here is a working forumula, but if the user typed in “Doug” the output would end up being “Searching Doug”:

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/0/020e73196f7215d64f32cb19835832436b4e3ee7.png)

Is there a way to essentially say “If [VARIABLE A] is **not** empty, show [CUSTOM STRING A] . Otherwise, show [CUSTOM STRING B]”?

---

<div class="post-metadata">

**Author:** ![brandon](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/brandon/32/2804_2.png) [@brandon](https://community.weweb.io/u/brandon)\
**Post date:** [July 21, 2023, 7:47pm UTC](https://community.weweb.io/t/question-regarding-the-ifempty-function/3635/2 "2023-07-21T19:47:22Z")

</div>

Found my own answer! Looks like this can be done through a simple “If” function as shown here:

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/4/4533373ae20b0d1e5c67a759a014b3738a722653.png)

My initial concern was that because my search input variable wasn’t returning a literal true/false this method wouldn’t work but it indeed does!

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [July 21, 2023, 10:41pm UTC](https://community.weweb.io/t/question-regarding-the-ifempty-function/3635/3 "2023-07-21T22:41:07Z")

</div>

[falsy values](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) can be useful
