I have two Sharepoint lists. In List 1, I have a lookup column with additional fields linked to List 2. I am able to format the lookup column itself but I dont know how to do it for additional fields.
They are always shown as Value 1; Value 2; Value 3
Column name of my additional field is "TrackingNumbers_x003a_ShippedTo" So TrackingNumbers is the lookupField (it shows it as "Field=Tracking0" at the address bar for some reason).
Update:
Thanks to Chris, I was able to accomplish the look I wanted. Ok I wasnt able to get rid of ";" semi-colons but at least now they each appear on new line so they are aligned with tracking numbers lookup column. So in short "@currentField" is how you reference to lookup column additional fields but as Chris says they come as single string. I didnt bother to remove semi-colons because it has limitations Chris mentions. The formulas get too complicated and you can show limited number of values with formatting.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"debugMode": true,
"style": {
"flex-direction": "column",
"align-items": "flex-start",
"margin-top": "2px",
"padding-right": "0px",
"width": "100%",
"overflow": "hidden"
},
"children": [
{
"elmType": "div",
"txtContent": "@currentField",
"style": {
"color": "#333333",
"vertical-align": "middle",
"width": "24px"
}
}
]
}