Forum Discussion
lbrown1375
May 20, 2022Copper Contributor
substring statement is not working on my column formatting
On a sharepoint list on a modern site there is a single text field with the following data : test~substring I have added the below JSON to format this column to show the text 'test' but the subs...
RobElliott
May 20, 2022Silver Contributor
lbrown1375 there's an incorrect comma at the end of the txtContent line. And indexOf needs a capital O.
Try this:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "span",
"txtContent": "=substring(@currentField, 0, indexOf(@currentField,'~'))"
}
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
lbrown1375
May 20, 2022Copper Contributor
Thanks Rob, I have just spotted that typo now too !