function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dirk VisserDirk Visser 

Substitute linefeed with comma

I want in a formula field the linefeed being replace with a comma. Although I used the chr(10) equivalent thru my numpad, it doesn't replace it. How can I do it ?
Best Answer chosen by Dirk Visser
Saravana Muthu 8Saravana Muthu 8
Please mark it as best answer if it solved your issue.

So that it will be helpful to others.

Thanks,
Saravana
 

All Answers

Saravana Muthu 8Saravana Muthu 8
Hi,


Can you please share the formula you have used?

Also please refer this link if it helps.

https://salesforce.stackexchange.com/questions/18909/find-line-break-in-formula-field

Thanks,
Sarav
Sweet Potato Tec
Dirk VisserDirk Visser
I want to use the following :
SubStitute (cText, "◙", ",")

The "◙" stand for character 10 which is the linefeed character.
Saravana Muthu 8Saravana Muthu 8
Hi,

You can't directly substitute linebreak with comma.

Workaround:

Create a custom setting Global with a text area field CRLF and set the value as below.

a
b

Then use the below formula in the formula.

SUBSTITUTE(Text_LF__c, MID($Setup.Global__c.CRLF__c,3,1), ",")

Global__c - Custom Setting
CRLF__c - Custom setting field.

Text_LF__c is the text field in the object.

Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.

Thanks,
Sarav
Sweet Potato tec
Dirk VisserDirk Visser
Thanks this was the answer I needed
Saravana Muthu 8Saravana Muthu 8
Please mark it as best answer if it solved your issue.

So that it will be helpful to others.

Thanks,
Saravana
 
This was selected as the best answer
Alexis KasperaviciusAlexis Kasperavicius
For anyone else looking at this, Saravana's solution does work even if it is unorthadox. What's happening is three characters are being stored in the variable (a<CRLF>b). Then MID is used to extract only <CRLF> for use in a substitute formula. This is neccesary because the variables won't save unless text exists. A very nice little trick!

Note, this works in other contexts too. Instead of using the global variable, I just needed to do this within a flow - so I created a text template within the flow with the a/b text and used it with a substitute formula in exactly the same way.