First line in addresses

Hi:

I’m working on some mailing here, and I need your help for getting the proper the street address (billing street for accounts, or primary address for contacts). I need to use only the first line entered in the text area. That value is to be used in a calculated field in workflows.
How can I extract that very first line?

Thank you!

To extract the first line of a text area field in SuiteCRM, you can use a combination of the SUBSTRING_INDEX and TRIM functions in the formula editor of the calculated field.

Assuming the text area field is called “Billing Street” for accounts or “Primary Address” for contacts, the formula to extract the first line would be:

For Accounts:

less

TRIM(SUBSTRING_INDEX({billing_street},‘\n’,1))

For Contacts:

less

TRIM(SUBSTRING_INDEX({primary_address},‘\n’,1))

This formula uses the newline character (\n) as the delimiter to split the text area field into multiple lines and then returns only the first line using the SUBSTRING_INDEX function. The TRIM function is then used to remove any leading or trailing white spaces from the first line.

You can use this formula in your workflows to set the value of a calculated field based on the first line of the text area field.

1 Like