Removing extra line breaks in lists

I'm using this in my snippet to insert a list:

{note: preview=no; trim=left}{listversion=split(assumptions,"|"); trim=yes}{endnote}
{repeat: for (item, index) in listversion}{=item; trim=yes}{if: index < count(listversion)-1}
{endif}{endrepeat}

The raw data in the 'assumptions' field is:
2 bank accounts with 2 transactions/mo.|
5 transactions that need to be split across accounts.|
|
Square account(s) with 4 transactions.|
4 manual adjusting entries /mo.|
No invoices created.|
No bill payments.|
No cheques printed.|

It's producing this output:

I've tried all the trim options (Yes, No, Left, Right) on various parts of the code and I can't get it to stop inserting an extra line break at the end of each line. Can you help?

Hi @Jonathan_Burns, welcome back to the forum. :slight_smile:

Can you please try replacing {=item; trim=yes} with {=trim(item)} and let me know if that resolves your issue?

It worked! Amazing! Thank you!

Is there a way to get it to skip blank lines from the inbound data in the list?

You can replace {listversion=split(assumptions,"|"); trim=yes} with {listversion=[trim(x) for x in split(assumptions,"|")]}, please let me know if that works for you.

It doesn't seem to. There are still some blank lines coming through. Any suggestions?

@Jonathan_Burns Can you please share the full snippet, or at least the part with the issue?

Here is the part of the snippet with the issues.

Key Assumptions:
Our estimate is based on these assumptions:
{note: preview=no; trim=left}{listversion=[trim(x) for x in split(assumptions,"|")]}{endnote}
{repeat: for (item, index) in listversion}{=trim(item)}{if: index < count(listversion)-1}
{endif}{endrepeat}
The one-time setup fee includes:
{note: preview=no; trim=left}{listversion2=split(setup fee includes, "|")}{endnote}
{repeat: for (item, index) in listversion2}{=trim(item)}{if: index < count(listversion2)-1}
{endif}{endrepeat}

Here is a screenshot of the result.

@Jonathan_Burns

To skip those blank lines, you can use a condition in the list comprehension as follows:
{listversion=[trim(x) for x in split(assumptions,"|") if trim(x) <> ""]}