Skip to main content

Hello Team,

 

I have a requirement to split the billing street when it exceeds 60 characters. This is the formula I used, which works fine, but it splits the text at the character length, and I'd like to improve it by splitting it at the last space before 60 characters, then add the rest of the string to the second line.

 

Current Formula:

LEFT({!$Record.BillingStreet},60) + 

BR() +

RIGHT(BillingStreet},(LEN(BillingStreet)-60))

Address before: xxxxxxBillingStreet, Technology Way, Scenic Brightview, Apartment 12

Address after: xxxxxxBillingStreet, Technology Way, Scenic Brightview, Apar

tment 12

Desired result: xxxxxxBillingStreet, Technology Way, Scenic Brightview, 

Apartment 12

 

I think I'm on the right track with this formula - it finds the correct place to split the string, but it cuts of the last word because of my 60-character limit:

RIGHT(LEFT(BillingStreet,60),FIND(" ", REVERSE(LEFT(BillingStreet,60))) - 1)

Result: Apar

 

Any ideas would be greatly appreciated!

 

Thank you!

4 respuestas
  1. Eric Praud (Activ8 Solar Energies) Forum Ambassador
    8 sep 2023, 1:52 p.m.

    Just found an issue with my formulas if the Street is less than 60 chars, so go with this instead:

    First 60 chars:

    IF(LEN(BillingStreet)<=60, BillingStreet,

    SUBSTITUTE(LEFT(BillingStreet,60),

    RIGHT(LEFT(BillingStreet,60),FIND(" ", REVERSE(LEFT(BillingStreet,60))) - 1),NULL))

    Last chars:

    IF(LEN(BillingStreet)<=60, NULL,

    SUBSTITUTE(BillingStreet,

    SUBSTITUTE(LEFT(BillingStreet,60),

    RIGHT(LEFT(BillingStreet,60),FIND(" ", REVERSE(LEFT(BillingStreet,60))) - 1),NULL),NULL))