Add a text/field name if a value exists

I want to at text to the output of a value.

if value exists in a variable then prepend the word/text “NAME:”

lets say the value for data.name is JOHNDOE, I want to prepend with the text “NAME:” so the output now looks like NAME: JOHNDOE. I am able to do this by using this {ifempty(NAME: .data.name; )} but by doing this it always adds the Text “NAME:” even if the value is empty. So when there is no value in data.name I still get the text NAME:.

I only want NAME: prepended to the output when there is a value set for data.name

Any help would be appreciated.

Thank You

Welcome to the Make community!

You can use the built-in function if and length

e.g.:

{{ if(length(1.name) > 0; "NAME: " + 1.name; 1.name) }}

Screenshot_2024-05-09_200504

For more information, see

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

2 Likes