2

I am trying to remove all of "AAA" links from a link column called "LinkList" using JSON column formatting.

"AAA" is a link not text. I am in trouble to hide all of this kind of cells in that column.

Tried some coding, but most of them hide all this column or just made some links unavailable.

Please help me.
Thanks!

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "a",
  "txtContent": "@currentField.desc",
  "attributes": {
    "href": "=if("LinkList"==[$AAA], ‘hide’ , '’)",
    "Target": "_blank"
  }
}
  • How you have added "AAA" as a URL in hyperlink field? It should either be like http://AAA or https://AAA. – Ganesh Sanap Oct 9 '19 at 12:59
1

As you are saying:

"AAA" is a link not text

I believe it should either be like http://AAA or https://AAA.

So in that case you can use below JSON code to hide the links with http://AAA or https://AAA:

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "a",
    "txtContent": "@currentField.desc",
    "attributes": {
        "href": "=if((@currentField=='http://AAA' || @currentField=='https://AAA'),'#',@currentField)",
        "target": "_blank"
    },
    "style":{
        "display":"=if((@currentField=='http://AAA' || @currentField=='https://AAA'),'none','block')"
    }
}

Original List values (Before formatting):

enter image description here

Output (After formatting):

enter image description here

Official documentation: Use column formatting to customize SharePoint.

|improve this answer|||||
0

We can use the column formatting below to achieve it.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "a",
  "txtContent": "@currentField.desc",
  "attributes": {
    "href": "=if(@currentField.desc=='AAA','#',@currentField)",
    "Target": "_blank"
  },
  "style":{
    "display":"=if(@currentField.desc=='AAA','none','block')"
  }
}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.