Add a line break before and after text string from DataBlaze

I'm inserting a text strong from Data Blaze using this:

{if: catch up hours=0}{else}{=catch up expected}{endif}

So if there are no catchup hours it should insert nothing. Does that approach require a "0" in the cell. What if the cell is blank rather than having a xero? Would it better better to use

{if: catch up hours=""}{else}{=catch up expected}{endif}

'catch up expected' is a line of text and I want to insert one line break before and after it but I can't get the syntax right. Do I use concatenate? What do I use for a line break? \n or \s or $1

(I'm new to grep)

I tried this but it doesn't work:
{if: catch up hours=""}{else}{= \r catch up expected \r}{endif}

Thanks

Hi again Jonathan,

If you're evaluating a string to determine if it's blank, use the syntax ==""

You need the double equals sign for comparison, and the "" will be read as blank.

For the second part of the question, You can do that with the concat function:

{`catch up hours`="whatever text"}
{if: `catch up hours`==""}{else}{=concat("\n",`catch up hours`,"\n")}{endif}

2 Likes

I managed to get it to work using:

{`catch up hours`="first text"}
{`catch up expected`="second text"}
{if: `catch up hours`==""; trim=no}{else}{=concat("\n",`catch up expected`, "\n")}{endif}

so thank you very much Andrew!