Forum Discussion
SharePoint JSON Formatting using split and the resulting array
- Jan 11, 2024
I couldn't find a way to access the resulting array either.
Like @suvi-15 pointed you can use the substring instead. But in this case, accessing another field requires this markup [$ColumnName] and not the @ColumnName
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "=substring([$Supervisor.email], 0, indexOf([$Supervisor.email],'@'))" }
Additional note: I couldn't access a field that has a space in it.
ex.:
[$Supervisor Info.email] doesn't work.
[$SupervisorInfo.email] works.
_J-K_ try to use
"children": [
{
"elmType": "span",
"txtContent": "=substring(@currentField.email, 0, indexOf(@currentField.email,'@'))"
},
{
"elmType": "span",
"txtContent": "=substring(@currentField.email, indexOf(@currentField.email,'@'), length(@currentField.email))"
}
]
I haven't tested but you get more info from this link https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/formatting-syntax-reference
Br,
Suvi
Please free to ask question, if this solves your purpose mark this as answered.