Help

Re: Prevent line breaks when empty lines

Solved
Jump to Solution
2304 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Vianney
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi everybody!

I'm trying to modify the formula below so that the empty lines don't show up and don't make a line break with empty lines.
For each of the 18 lines I have {FormatX EANX Concatenated} from an other field where {FormatX EANX Concatenated} can be empty or not.
If the {FormatX EANX Concatenated} is empty, I don't want an empty line.

 

 
{Format1 EAN1 Concatenated} & "\n" & {Format2 EAN2 Concatenated} & "\n" & {Format3 EAN3 Concatenated} & "\n" & {Format4 EAN4 Concatenated} & "\n" & {Format5 EAN5 Concatenated} & "\n" & {Format6 EAN6 Concatenated} & "\n" & {Format7 EAN7 Concatenated} & "\n" & {Format8 EAN8 Concatenated} & "\n" & {Format9 EAN9 Concatenated} & "\n" & {Format10 EAN10 Concatenated} & "\n" & {Format11 EAN11 Concatenated} & "\n" & {Format12 EAN12 Concatenated} & "\n" & {Format13 EAN13 Concatenated} & "\n" & {Format14 EAN14 Concatenated} & "\n" & {Format15 EAN15 Concatenated} & "\n" & {Format16 EAN16 Concatenated} & "\n" & {Format17 EAN17 Concatenated} & "\n" & {Format18 EAN18 Concatenated}
 
I have tried with the IF function but didn't succeed.
Thanks for helping.
1 Solution

Accepted Solutions
Ben_Young1
11 - Venus
11 - Venus

Hey @Vianney!
Try this formula:

 

TRIM(
    IF(
        {Format1 EAN1 Concatenated},
        {Format1 EAN1 Concatenated} & "\n"
    )
    &
    IF(
        {Format2 EAN2 Concatenated},
        {Format2 EAN2 Concatenated} & "\n"
    )
    &
    IF(
        {Format3 EAN3 Concatenated},
        {Format3 EAN3 Concatenated} & "\n"
    )
    &
    IF(
        {Format4 EAN4 Concatenated},
        {Format4 EAN4 Concatenated} & "\n"
    )
    &
    IF(
        {Format5 EAN5 Concatenated},
        {Format5 EAN5 Concatenated} & "\n"
    )
    &
    IF(
        {Format6 EAN6 Concatenated},
        {Format6 EAN6 Concatenated} & "\n"
    )
    &
    IF(
        {Format7 EAN7 Concatenated},
        {Format7 EAN7 Concatenated} & "\n"
    )
    &
    IF(
        {Format8 EAN8 Concatenated},
        {Format8 EAN8 Concatenated} & "\n"
    )
    &
    IF(
        {Format9 EAN9 Concatenated},
        {Format9 EAN9 Concatenated} & "\n"
    )
    &
    IF(
        {Format10 EAN10 Concatenated},
        {Format10 EAN10 Concatenated} & "\n"
    )
    &
    IF(
        {Format11 EAN11 Concatenated},
        {Format11 EAN11 Concatenated} & "\n"
    )
    &
    IF(
        {Format12 EAN12 Concatenated},
        {Format12 EAN12 Concatenated} & "\n"
    )
    &
    IF(
        {Format13 EAN13 Concatenated},
        {Format13 EAN13 Concatenated} & "\n"
    )
    &
    IF(
        {Format14 EAN14 Concatenated},
        {Format14 EAN14 Concatenated} & "\n"
    )
    &
    IF(
        {Format15 EAN15 Concatenated},
        {Format15 EAN15 Concatenated} & "\n"
    )
    &
    IF(
        {Format16 EAN16 Concatenated},
        {Format16 EAN16 Concatenated} & "\n"
    )
    &
    IF(
        {Format17 EAN17 Concatenated},
        {Format17 EAN17 Concatenated} & "\n"
    )
    &
    IF(
        {Format18 EAN18 Concatenated},
        {Format18 EAN18 Concatenated} & "\n"
    )
)

 

See Solution in Thread

4 Replies 4
Ben_Young1
11 - Venus
11 - Venus

Hey @Vianney!
Try this formula:

 

TRIM(
    IF(
        {Format1 EAN1 Concatenated},
        {Format1 EAN1 Concatenated} & "\n"
    )
    &
    IF(
        {Format2 EAN2 Concatenated},
        {Format2 EAN2 Concatenated} & "\n"
    )
    &
    IF(
        {Format3 EAN3 Concatenated},
        {Format3 EAN3 Concatenated} & "\n"
    )
    &
    IF(
        {Format4 EAN4 Concatenated},
        {Format4 EAN4 Concatenated} & "\n"
    )
    &
    IF(
        {Format5 EAN5 Concatenated},
        {Format5 EAN5 Concatenated} & "\n"
    )
    &
    IF(
        {Format6 EAN6 Concatenated},
        {Format6 EAN6 Concatenated} & "\n"
    )
    &
    IF(
        {Format7 EAN7 Concatenated},
        {Format7 EAN7 Concatenated} & "\n"
    )
    &
    IF(
        {Format8 EAN8 Concatenated},
        {Format8 EAN8 Concatenated} & "\n"
    )
    &
    IF(
        {Format9 EAN9 Concatenated},
        {Format9 EAN9 Concatenated} & "\n"
    )
    &
    IF(
        {Format10 EAN10 Concatenated},
        {Format10 EAN10 Concatenated} & "\n"
    )
    &
    IF(
        {Format11 EAN11 Concatenated},
        {Format11 EAN11 Concatenated} & "\n"
    )
    &
    IF(
        {Format12 EAN12 Concatenated},
        {Format12 EAN12 Concatenated} & "\n"
    )
    &
    IF(
        {Format13 EAN13 Concatenated},
        {Format13 EAN13 Concatenated} & "\n"
    )
    &
    IF(
        {Format14 EAN14 Concatenated},
        {Format14 EAN14 Concatenated} & "\n"
    )
    &
    IF(
        {Format15 EAN15 Concatenated},
        {Format15 EAN15 Concatenated} & "\n"
    )
    &
    IF(
        {Format16 EAN16 Concatenated},
        {Format16 EAN16 Concatenated} & "\n"
    )
    &
    IF(
        {Format17 EAN17 Concatenated},
        {Format17 EAN17 Concatenated} & "\n"
    )
    &
    IF(
        {Format18 EAN18 Concatenated},
        {Format18 EAN18 Concatenated} & "\n"
    )
)

 

Hi @Ben_Young1  I have added a few comma missing in your code ...... and it works! 😀

Thank you very much! I didn't think tu use the TRIM function that I need to improve to use.
Thanks a lot! 🙏

Woops... appreciate the pointer on the missing commas!
Just corrected the original snippet.

Happy to help!

NICK75
5 - Automation Enthusiast
5 - Automation Enthusiast

I have a similar problem with my script that do not work : I'm trying to modify the formula below so that the empty lines don't show up and don't make a line break with empty lines.

{MARQUES} &
IF({DESIGNER}, " X " & {DESIGNER}) &
IF({DATATION}, " - " & {DATATION}) & "\n" &
IF({COLLECTION}, " " & {COLLECTION}) & "\n" &
IF({FABRICATION}, " " & {FABRICATION}) & "\n" &
IF({PRODUIT}, " " & {PRODUIT}) &
IF({MODELE}, " - " & {MODELE}) & "\n" &
IF({MATIERES}, " " & {MATIERES}) & "\n" &
IF({COULEURS}, " " & {COULEURS}) & "\n" &
IF({DETAIL}, " " & {DETAIL}) &
IF({GRIFFES}, " , " & {GRIFFES}) & "\n" &
IF({PROVENANCE}, " " & {PROVENANCE}) & "\n" &
IF({TAILLES}, " " & {TAILLES}) & "\n" &
IF({CONDITION REPORT}, " " & {CONDITION REPORT} & "\n" &
IF({ICONOGRAPHIES}, " " & {ICONOGRAPHIES})
)