substring statement is not working on my column formatting

Copper Contributor

On a sharepoint list on a modern site there is a single text field with the following data :



I have added the below JSON to format this column to show the text 'test' but the substring does not seem to be recognised and I only see the text from within the substring :=substring(@currentField, 0, indexof(@currentField,'~')) 


Can anybody please help with this behaviour 


"$schema": "",

"elmType": "span",
"txtContent": "=substring(@currentfield, 0, indexof(@currentfield,'~'))",


2 Replies

@lbrown1375 there's an incorrect comma at the end of the txtContent line. And indexOf needs a capital O.


Try this:

"elmType": "span",
"txtContent": "=substring(@currentField, 0, indexOf(@currentField,'~'))"
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
Thanks Rob, I have just spotted that typo now too !