SOLVED

Use crawl properties like filter in a URL or a javascript, it's possible ?

%3CLINGO-SUB%20id%3D%22lingo-sub-2229880%22%20slang%3D%22en-US%22%3EUse%20crawl%20properties%20like%20filter%20in%20a%20URL%20or%20a%20javascript%2C%20it's%20possible%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2229880%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3BIt's%26nbsp%3B%20possible%20to%20use%26nbsp%3B%3CSPAN%3EMapped%20Crawled%20Properties%20like%20list%20filter%20in%20the%20web%20site%20URL%20%3F%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EActually%2C%20I%20make%20test%20to%20force%20filter%20on%20somes%20lists%20columns%20in%20my%20page.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ETo%20have%20the%20right%20url%20structure%2C%20I%20have%20manually%20check%20the%20information%20in%20my%20comlumns.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ENow%20I%20try%20to%20tweak%20the%20url%20to%20always%20filter%20the%20list%20by%20siteTitle%20ou%20SiteName.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EHere%20is%20the%20string%20than%20I%20try%20to%20add%20a%20the%20end%20of%20my%20url.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%22%20%3FView%3D%7B29A449F3-54E8-4D8F-8BEB%206E41C8F699C0%7D%26amp%3BFilterField1%3Dcolumn_title%26amp%3BFilterValue1%3Dows_SiteName%20%23InplviewHash1a5a672d-1e52-4f51-969d-39d766990dbe%3DFilterField1%253DTitle-FilterValue1%3Dows_SiteName%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20I%20write%20manually%20the%20subsite%20name%20like%20FilterValue1%20that's%20work.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EBut%20like%20I%20use%20a%20template%20to%20generate%20the%20subsite%2C%20I%20would%20like%20auto%20push%20the%20subsite%20title%20like%20FilterValue1%20in%20the%20URL.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20have%20found%20in%20the%26nbsp%3B%20Mapped%20Crawled%20Properties%20below.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20have%20try%26nbsp%3BFilterValue1%3Dows_SiteName%20and%26nbsp%3BFilterValue1%3DSiteTitle%2C%20but%20this%20is%20view%20like%20string.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20have%20try%20to%20change%20for%20%22ows_SiteName%22%20or%20%24ows_SiteName.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EBut%20this%20not%20work.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20have%20found%20another%20solution%2C%20but%20it's%20not%20work%20at%20100%25.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20script%20below%20make%20than%20we%20could%20search%20value%20in%20a%20table%20and%20hide%20the%20other%20row.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20have%20try%20to%20modify%20the%20script%20to%20connect%20this%20one%20on%20my%20list.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThat's%20work%20and%20the%20script%20detecte%20all%20the%20row%2C%20but%20the%20index%20stay%20always%20at%20-1%20for%20each%20row.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIt's%20like%20the%20script%20could%20not%20catch%20the%20content%20of%20the%20table%20row.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20I%20could%20make%20this%20script%20working%20and%20force%20the%20subsite%20title%20like%20input%20that's%20could%20be%20the%20solution.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20could%20view%20the%20script%20in%20the%20attach%20file.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20idea%20is%20welcome.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2229880%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ELists%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Server%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESites%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

Hi, 

 It's  possible to use Mapped Crawled Properties like list filter in the web site URL ? 

Actually, I make test to force filter on somes lists columns in my page. 

To have the right url structure, I have manually check the information in my comlumns.

Now I try to tweak the url to always filter the list by siteTitle ou SiteName. 

Here is the string than I try to add a the end of my url.

 

" ?View={29A449F3-54E8-4D8F-8BEB 6E41C8F699C0}&FilterField1=column_title&FilterValue1=ows_SiteName #InplviewHash1a5a672d-1e52-4f51-969d-39d766990dbe=FilterField1%3DTitle-FilterValue1=ows_SiteName"

 

If I write manually the subsite name like FilterValue1 that's work. 

But like I use a template to generate the subsite, I would like auto push the subsite title like FilterValue1 in the URL. 

 

I have found in the  Mapped Crawled Properties below.

I have try FilterValue1=ows_SiteName and FilterValue1=SiteTitle, but this is view like string. 

I have try to change for "ows_SiteName" or $ows_SiteName. 

But this not work. 

 

 

I have found another solution, but it's not work at 100%. 

The script below make than we could search value in a table and hide the other row.

 

I have try to modify the script to connect this one on my list. 

That's work and the script detecte all the row, but the index stay always at -1 for each row.

It's like the script could not catch the content of the table row. 

 

If I could make this script working and force the subsite title like input that's could be the solution.

 

​You could view the script in the attach file. 

 

Any idea is welcome.

 

1 Reply
best response confirmed by Marc-Etienne_Tremblay (Occasional Contributor)
Solution
After many time of research I have finally resolve my issue with a content editor and a javascript.
I have find information about javascript on this web site.

https://www.linkedin.com/pulse/sharepoint-list-filtering-javascript-maryam-kaveh
I need to adapt the script for my needs here is a copy of my script.

function myFunction() {
// catch the path and delete "/"
var url = location.pathname.split("/").slice(-3);
var titleprojet;
// loop in the values and copie the first one who are the project title.
var i;
for (i = 0; i < url.length; i++) {

if (i == 0) {
titleprojet = url[i];

}
}

//Switch the title in lowerCase
titleprojet = titleprojet.toLowerCase();

// check if the project title is present in all webparts of the page.
// if the project title if found in the webparts table, show the line of row.
//if not hide the line of row.

if (titleprojet) {


$("#WebPartWPQ2").find("tr.ms-itmhover:not(:Contains("+titleprojet+"))").hide();


$("#WebPartWPQ2").find("tr.ms-itmhover:Contains("+titleprojet+")").show();

$("#scriptWPQ6").find("tr.ms-itmhover:not(:Contains("+titleprojet+"))").hide();


$("#scriptWPQ6").find("tr.ms-itmhover:Contains("+titleprojet+")").show();



} else {


$("#WebPartWPQ2").find("tr.ms-itmhover").show();

$("#scriptWPQ6").find("tr.ms-itmhover").show();
}


}
//Wait than all page elements is loaded before execute myFunction.
// That's give the time to the browser to load the information and show the webparts with the good information.
document.addEventListener("DOMContentLoaded", myFunction);

The result is than SharePoint execute the javascript catch the subsite name and use it like filter on each webparts of the page.
Take care, to change the webpart name in this script for ours and take note, the filtering function work on all columns and row.

So if you want only the line where the title is november or include november.
Besure to modify the view to mask columns where we could find november like the creation date columns.
Because, you could have 2 or more results in the table.

Ex: If you have the table below and you want only the record with the november title.

title | description | create date
november | bla bla bla | 2021 november 4
project 2 | bla bla bla | 2021 november 30

the result after the script process will be than the table will include the 2 records.
Because, the november string will be found in the create date too.

Hope this help.