1

Trying to remove all commas from a single line of text SharePoint Online field entries.

Any ideas on how to achieve that, any formatting formulas, or JSON?

Thank you in advance!

4
  • Where are you trying this? What have you tried so far? What worked, what did not work? Please be a bit more specific. Commented May 28, 2019 at 12:20
  • Hi Nils, tried this formula that is meant to be for a single line of text, but didn't work, the commas are still present - =ISNUMBER([ColumnName]+0) . Trying to find any JSON options, but nothing so far. I guess I can do it with jQuery, but then I need to return to classic mode and I want it to work in modern. Commented May 28, 2019 at 13:11
  • Wouldn't an SPFx extension esp. a Field Customizer be what you'd want? Commented May 28, 2019 at 13:40
  • Don't know what that is? Commented May 29, 2019 at 11:37

3 Answers 3

1

SharePoint JSON formatting now supports replaceAll operator which you can use to remove all commas from a single line of text.

Example:

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent":"=replaceAll(@currentField, ',', '')" } 

Reference: SharePoint: Replace All Occurrences of Substring in a String using JSON Formatting

0

You would need to create an SPFx FieldCustomizer

Essentially you then would write

@override public onRenderCell(event: IFieldCustomizerCellEventParameters): void { event.domElement.innerHTML = `<div>${event.fieldValue.replace(/[,\.]/g, "")}</div>`; } 

or whatever modifications you'd want to make.

0

Json column formmatting not provide operators to remove/replace special character currently: enter image description here

A workaround is to update the single line text field with CSOM Console Application directly to remove commas, please see the same question in the Technet I have replied yesterday:

Remove all commas from single line of text field

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.