Team,
I am using the SharePoint conditional formatting (bottom) to display a PDF icon in lieu of a URL link to a PDF (I run a Power Automate flow to create a PDF copy of each file uploaded to SharePoint, and I want to display an image link to the PDF copy).
The JSON below works well, except it also generates icons for sub-folders in the document library.
I need help to tweak the JSON below so that when @currentField is blank, the JSON is not run, or it suppresses the "children" properties.
If I simply place an IF statement in the SRC value, for example...
"src": "=if(@currentField = '', '', '../../SiteAssets/PDF_icon_32x32.png')"
It will display PDF icons for the files, but displays an empty image icon for the folders, rather than nothing at all.
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "a", "txtContent": "", "attributes": { "target": "_blank", "href": "[$PDFlink]" }, "style": { "text-decoration": "none" }, "children": [ { "elmType": "img", "style": { "display": "block", "position": "relative", "width": "32px", "height": "32px" }, "attributes": { "src": "../../SiteAssets/PDF_icon_32x32.png" } } ] } Is there a way to use the ? operator to encapsulate the children parameters into an if/then block?