How to concatenate a column value using column formatting
When formatting list columns in SharePoint and Microsoft Lists you might have the need to concatenate a column value to modify value in the new structure representing the information.
With list formatting you can concatenate a column value with other columns or strings using an operator, in this article I will show you how to concatenate a values to get a different value in the column using the YouTube thumbnail formatting from one of my previous articles.
To concatenate two or more values, you will need to use the + operator along with an array with all the values you want to see together as represented in the following example.
"elmType": "img", "attributes": { "src": { "operator": "+", "operands": [ "https://img.youtube.com/vi/", "=substring(@currentField, 32, 44)", "/mqdefault.jpg" ] } }
In the above example you can also observe the substring function that is used to split a column value, to learn more about this process have a look here.
The following list has all the types that can be used in the concatenation along with a basic representation of each one.
- A simple string – “this is a string”
- A value from the column itself – @currentField
- A value from another columns – [$FieldName]
No comments yet