Forum Discussion
SharePoint - Filter stacking
I reviewed the question and got answers most of my previous queries. However, Iām still unclear on how the link is added or generated in the list.
I assume there is a text field where values are entered, and JSON formatting is used to generate the cross-reference link.
- I created a library where all documents are stored, and it includes a Document_ID text column. I assign an ID to each document as needed.
I also have another list that contains the same Document_ID column (configured as a text column rather than a hyperlink), where the Document ID value is entered. Using JSON formatting, I generate cross-reference links from the list to the library.
This JSON works for filtering a single ID; handling multiple IDs would require a different approach.
The URL structure contains the following components:
- MSTrainings ā Site name
- CMS ā Document library name
- CMS DS Content Type.aspx ā Library view name
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"white-space": "normal"
},
"attributes": {
"class": "sp-css-backgroundColor-warningBackground"
},
"children": [
{
"elmType": "span",
"style": {
"margin-right": "2px",
"margin-left": "5px",
"font-size": "18px"
},
"attributes": {
"iconName": "FileSymlink"
}
},
{
"elmType": "a",
"attributes": {
"href": {
"operator": "+",
"operands": [
"https://YOURTENANT.sharepoint.com/sites/MSTrainings/CMS/Forms/CMS DS Content Type.aspx?FilterField1=Document_ID&FilterType1=Text&FilterValue1=",
"[$Document_ID]",
"&DefaultItemOpen=1"
]
},
"target": "_blank"
},
"style": {
"color": "#0078d4",
"text-decoration": "none",
"font-weight": "600",
"padding": "2px 4px",
"border-radius": "3px",
"transition": "all .2s ease-in-out"
},
"txtContent": "[$Document_ID]"
}
]
}
If my post solved your issue or answered your query, please mark it as a Solution and give it a Like.