Mar 13 2023 03:06 AM
Hi everyone,
It's been quite some time and I haven't been able to find an answer to my issue. To give some background I am not a developer, however I do work with SharePoint everyday and have managed to format JSON.
I have a SharePoint online list with columns. One of the columns is a text field with a social security number. I want my numbers to be be display this way : x xx xx xx xxx xxx xx
Is it something that can be done in SharePoint ? If so, how can I achieve that ?
Thank you very much !
Selma
Mar 13 2023 04:42 AM
SolutionHi @SelmaA
You can use this, if you have a text column
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "span",
"txtContent": "=substring(@currentField, 0, 1) + ' '+substring(@currentField, 1, 3)+ ' '+substring(@currentField, 3, 5)+ ' '+substring(@currentField, 5, 7)+ ' '+substring(@currentField, 7, 10)+ ' '+substring(@currentField, 10, 13)+ ' '+substring(@currentField, 13, 15)"
}
and this, if you have a number column
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "span",
"txtContent": "=substring(toString(@currentField), 0, 1) + ' '+substring(toString(@currentField), 1, 3)+ ' '+substring(toString(@currentField), 3, 5)+ ' '+substring(toString(@currentField), 5, 7)+ ' '+substring(toString(@currentField), 7, 10)+ ' '+substring(toString(@currentField), 10, 13)+ ' '+substring(toString(@currentField), 13, 15)"
}
Best Regards,
Sven
Mar 13 2023 06:04 AM