guessdip
asked on
Filter webpart for sharepoint documnet library columns
Hii All,
i have one documnet library with multiple columns. let's say i have one column name "Comapny" now i have 250 records in that library. now user wants to search by Company name . i got some out of box web parts but in that web part we need to type whole word. user wants some "Like" methos. so they dont have to type whole word.
If they type A then they can get all records which start with A.
Can i have some third party or and custom or any Out of webpart for that??
i have one documnet library with multiple columns. let's say i have one column name "Comapny" now i have 250 records in that library. now user wants to search by Company name . i got some out of box web parts but in that web part we need to type whole word. user wants some "Like" methos. so they dont have to type whole word.
If they type A then they can get all records which start with A.
Can i have some third party or and custom or any Out of webpart for that??
ASKER
Hii,
Thanks for responding, i like your method. i tried for sharepoint list. it works fine. but when i use with documnet library with different columns i am getting odd solution. Also if i have any blank value then when i click reset it display only non blank records.
And i want search using Like statement. means if we type A , we can get result start with A only.
Hope you understand my problem. Let me know if you need more clarification..
Thanks for responding, i like your method. i tried for sharepoint list. it works fine. but when i use with documnet library with different columns i am getting odd solution. Also if i have any blank value then when i click reset it display only non blank records.
And i want search using Like statement. means if we type A , we can get result start with A only.
Hope you understand my problem. Let me know if you need more clarification..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hii,
Thank you so much for helping me. i got it for list and documnet library. but i have two document library. this logic work for only one. i dont know why second one is not working, both have same column. i am trying to solve this.
Do you know whay it is happaning, i also checked the column name.
Thank you so much for helping me. i got it for list and documnet library. but i have two document library. this logic work for only one. i dont know why second one is not working, both have same column. i am trying to solve this.
Do you know whay it is happaning, i also checked the column name.
ASKER
Hii,
i got the problem. Exactly i do have sharepoint 2010. And i am using document set feature. So each documnet has one documnet set ( just like folder with meta data). So it is not filter docuemnt set columns.
I am trying solve this but i dont think so i can solve this.
i got the problem. Exactly i do have sharepoint 2010. And i am using document set feature. So each documnet has one documnet set ( just like folder with meta data). So it is not filter docuemnt set columns.
I am trying solve this but i dont think so i can solve this.
ASKER
Hii Raphilass,
Definetly i like your solution and i will accept your solution but i have some questions for you. Do you have sharepoint 2010? Can you try to make any Documnet library and can you create Document set content type and try to upload doc??
Exactly i am having issue with filtering when Document Library has Documnet set. I am trying to solve this but no Luck.
Definetly i like your solution and i will accept your solution but i have some questions for you. Do you have sharepoint 2010? Can you try to make any Documnet library and can you create Document set content type and try to upload doc??
Exactly i am having issue with filtering when Document Library has Documnet set. I am trying to solve this but no Luck.
Hi There,
Sorry about the late reply, very busy at home and work :). I have sharepoint 2010 setup on a dev machine, I will try to make it when i finish the job i have to do tomorrow. I haven't really looked at 2010, so i may not get anywhere, but i will give it a go.
FYI there are lots of other things the content editor web part allows you to do which are pretty cool...Google it :)
I found this site particularly good.
http://blog.pathtosharepoint.com/2008/08/10/the-content-editor-web-part/
Something else i found out recently was how to add webparts into new, view and edit forms which should allow you to implement Javascript to show hide input fields based on other field entries among other things...
http://www.sharepointology.com/setup/add-web-parts-to-dispform-editform-or-newformaspx/
Sorry if you already knew this, I just love sharing ;)
Sorry about the late reply, very busy at home and work :). I have sharepoint 2010 setup on a dev machine, I will try to make it when i finish the job i have to do tomorrow. I haven't really looked at 2010, so i may not get anywhere, but i will give it a go.
FYI there are lots of other things the content editor web part allows you to do which are pretty cool...Google it :)
I found this site particularly good.
http://blog.pathtosharepoint.com/2008/08/10/the-content-editor-web-part/
Something else i found out recently was how to add webparts into new, view and edit forms which should allow you to implement Javascript to show hide input fields based on other field entries among other things...
http://www.sharepointology.com/setup/add-web-parts-to-dispform-editform-or-newformaspx/
Sorry if you already knew this, I just love sharing ;)
ASKER
Hey Dude,
Thanks for sharing. I will love it. You can try with documnets sets. and i will give you update. But i liked your approach. it works for sharepont list and simple document library.
Thanks for sharing. I will love it. You can try with documnets sets. and i will give you update. But i liked your approach. it works for sharepont list and simple document library.
Having problems figuring out how create a document set. Will persevere, However if this presents a view as a normal list, and you can filter using the field heading on the view, you can filter the list as to how you want to see it and post the URL or at least the querystring part here so i can take a look.
Cheers
Cheers
OK Got this working, First of all when i created my sample it only adds the Name field not the Title, you cannot filter the name field using this method.
In my sample i created a document library called document sets, I then added a document set called phils documents to which I added 4 excel spreadsheets. Within the document set / Library i changed the view to display the Title field also. This has to be shown in the view if we are to use it as a filter.
The URLS with a title filter on shown below.
URL of Document Library : http://l057/Document%20Sets/Forms/AllItems.aspx?View={B77F5689-221A-478B-B268-F E323F35B96 5}&FilterF ield1=Titl e&FilterVa lue1=Phils %20Documen t%20Set
URL of Document Set : http://l057/Document%20Sets/Forms/Document%20Set/docsethomepage.aspx?ID=2&FolderCTID=0x0120D52000449BCDC1D338BF4E80AEDE9EFC96F412&List=d6467a10-4540-46c6-814c-d087d141517a&RootFolder=%2FDocument%20Sets%2FPhils%20Document%20Set&View={B77F5689-221A-478B-B268-F E323F35B96 5}&FilterF ield1=Titl e&FilterVa lue1=Mail% 20Box%20Si zes
To get the form to work in the Document set we need to maintain the ID part of the querystring, it tells you which Document Set you are in. Basically the script changes to this....
The new function allows you to rerieve values from the querystring using their key. This is then declared in the original function and added tot he querystring when it is assembled with the URL
In my sample i created a document library called document sets, I then added a document set called phils documents to which I added 4 excel spreadsheets. Within the document set / Library i changed the view to display the Title field also. This has to be shown in the view if we are to use it as a filter.
The URLS with a title filter on shown below.
URL of Document Library : http://l057/Document%20Sets/Forms/AllItems.aspx?View={B77F5689-221A-478B-B268-F
URL of Document Set : http://l057/Document%20Sets/Forms/Document%20Set/docsethomepage.aspx?ID=2&FolderCTID=0x0120D52000449BCDC1D338BF4E80AEDE9EFC96F412&List=d6467a10-4540-46c6-814c-d087d141517a&RootFolder=%2FDocument%20Sets%2FPhils%20Document%20Set&View={B77F5689-221A-478B-B268-F
To get the form to work in the Document set we need to maintain the ID part of the querystring, it tells you which Document Set you are in. Basically the script changes to this....
The new function allows you to rerieve values from the querystring using their key. This is then declared in the original function and added tot he querystring when it is assembled with the URL
<script type="text/javascript">
function getQuerystring(key, default_)
{
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
function RedirectUrl()
{
var tb = document.getElementById("tbSearch").value;
var qs = getQuerystring('ID');
if(tb != null)
{
window.location.href="?FilterName=Title&FilterMultiValue=*"+tb+"*&ID="+qs;
}
return false;
} </script><table width="100%" border="0" cellpadding="5" celspaceing="0"><tbody><tr><td width="30%" style="text-align: right">Please enter a search term and click go to search by client name</td>
<td width="175" style="text-align: left"><input name="T1" width="150" id="tbSearch" type="text"/></td>
<td width="100" style="text-align: left"><input id="btnSearch" onclick="return RedirectUrl();" type="button" value="search"/> </td>
<td width="100" style="text-align: left"><input id="btnReset" onclick="return RedirectUrl();" type="button" value="reset"/> </td>
<td> </td></tr></tbody></table>
So for further explanation, lines 7 to 17 gets the value in the querystring based on the key used (In this case ID, not they are case sensitive)
This function is called in line 22, where qs is declared as the ID
Finally this is added to the querystring in line 25 (At the end)
One final word, thanks to http://www.bloggingdeveloper.com/post/JavaScript-QueryString-ParseGet-QueryString-with-Client-Side-JavaScript.aspx for the Function :)
This means that you would have 2 different scripts in the document library, on in the content editor webpart in the main doc library and the one just discussed in the page for the document sets.
This function is called in line 22, where qs is declared as the ID
Finally this is added to the querystring in line 25 (At the end)
One final word, thanks to http://www.bloggingdeveloper.com/post/JavaScript-QueryString-ParseGet-QueryString-with-Client-Side-JavaScript.aspx for the Function :)
This means that you would have 2 different scripts in the document library, on in the content editor webpart in the main doc library and the one just discussed in the page for the document sets.
ASKER
Hii,
I appreacite your respond. Exactly i tried your code in content editor web part. but when i click save i got url till "ID=". i did not get folder name url. And requiment is : i have 100 document sets and every document set has two documnets. Now i want to filter by Document set Title or and column, But main thing is i dont want to filter by documnet content type column. i want to filter by Document set content type.
And i dont have to display documents , i just have to filter document set..
Hope you understand.. I like your method and i am trying to solve this manually by url. i will let you know if i get solution.
Once agian thank you so much for helping me.. I am learning from you..
I appreacite your respond. Exactly i tried your code in content editor web part. but when i click save i got url till "ID=". i did not get folder name url. And requiment is : i have 100 document sets and every document set has two documnets. Now i want to filter by Document set Title or and column, But main thing is i dont want to filter by documnet content type column. i want to filter by Document set content type.
And i dont have to display documents , i just have to filter document set..
Hope you understand.. I like your method and i am trying to solve this manually by url. i will let you know if i get solution.
Once agian thank you so much for helping me.. I am learning from you..
ASKER
Hii,
When you filter any Document set title column we can url "http://guessdip/sites/Test/DocumentLibrary/Forms/AllItems.aspx?View={CC63AA08-E5B3-44FC-85D6- 13FBD6E082 7E}&Filter Field1=Tit le&FilterV alue1=ABC"
So i tried to use Filtername and FilterMultiValue instead of FilterField1 but it does not work, it display all records.
When you filter any Document set title column we can url "http://guessdip/sites/Test/DocumentLibrary/Forms/AllItems.aspx?View={CC63AA08-E5B3-44FC-85D6-
So i tried to use Filtername and FilterMultiValue instead of FilterField1 but it does not work, it display all records.
Hi My Friend,
I am not going to be able to look at this for a week or so as I am in the middle of moving and won't have interenet etc...
I will get back to it as soon as i can though and hopefully we can get an answer. If you could post the code you put in the web part I might be able to identify why the ID isn't presenting. Using a view will probably differ, i never tried that so will look into it when i get a chance,
I am not going to be able to look at this for a week or so as I am in the middle of moving and won't have interenet etc...
I will get back to it as soon as i can though and hopefully we can get an answer. If you could post the code you put in the web part I might be able to identify why the ID isn't presenting. Using a view will probably differ, i never tried that so will look into it when i get a chance,
ASKER
Thanks Dude.., Take your time. i will give you update by post.
<script type="text/javascript">
function getQuerystring(key, default_)
{
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
function RedirectUrl()
{
var tb = document.getElementById("tbSearch").value;
var qs = getQuerystring('ID');
if(tb != null)
{
window.location.href="?FilterName=Title&FilterMultiValue=*"+tb+"*&ID="+qs;
}
return false;
} </script><table width="100%" border="0" cellpadding="5" celspaceing="0"><tbody><tr><td width="30%" style="text-align: right">Please enter a search term and click go to search by client name</td>
<td width="175" style="text-align: left"><input name="T1" width="150" id="tbSearch" type="text"/></td>
<td width="100" style="text-align: left"><input id="btnSearch" onclick="return RedirectUrl();" type="button" value="search"/> </td>
<td width="100" style="text-align: left"><input id="btnReset" onclick="return RedirectUrl();" type="button" value="reset"/> </td>
<td> </td></tr></tbody></table>
ASKER
Hii There ,
I tried with documnet set but no luck. So please let me know if you got something. i am going to close this question. you can email me on guessdip@yahoo.com.
I tried with documnet set but no luck. So please let me know if you got something. i am going to close this question. you can email me on guessdip@yahoo.com.
ASKER
Thanks dude, I learnt so many things from you.
Hi There, Sorry i haven't been in touch. Once again busy at work. Thanks for awarding the points.
I am off on holiday soon for a week or so but after that I will try to take another look at this and hopefully help find a resolution.
I am off on holiday soon for a week or so but after that I will try to take another look at this and hopefully help find a resolution.
While you can use the form web part to pass values back and forth to filter lists, they cannot be wild carded to make a partial search. To enable this level of functionaility you have to head off into the realms of SharePoint designer, using the dataview web part and changing the query term to contains...a lot of work for little return.
By using the content editor webpart and the filter functionaility on the list we can create a similar simple search. Add a web part page and onto it insert the list webpart you want to filter and a content editor webpart. In the content editor web part edit the source to include your search form and a javascript onclick event for the button to repost the page with a filter based on the value entered into the form. Save and exit edit mode...your done. See the sample content editor script below.
This is the filter value, this can be retreived from a text box, by adding or removing the astericks it could be made into a starts with search, contains or ends with.
The form item could be a text box, or any other form control for that matter.
By using the notation FilterName# and FilterValue# you can create a search with multiple terms, where # is the number of each search term, ie. 1, 2 3 etc.
This is the static name of the field not the display name.
The example below creates a filter based on the entry entered in the input form and fitering the Title field.
<script type="text/javascript">
function RedirectUrl()
{
var tb = document.getElementById("t
if(tb != null)
{
window.location.href="?Fil
}
return false;
}
</script>
<table width="100%" cellpadding="5" celspaceing="0" border="0">
<tr>
<td style="text-align:right" width="30%">Please enter a search term and click go to search by client name</td>
<td style="text-align:left" width="175px"><input id="tbSearch" width="150px" type="text" name="T1"></td>
<td style="text-align:left" width="100px"><input type="button" id="btnSearch" value="search" onclick="return RedirectUrl();" />
</td>
<td style="text-align:left" width="100px"><input type="button" id="btnReset" value="reset" onclick="return RedirectUrl();" />
</td>
<td> </td>
</tr>
</table>
By adding multiple inputs and expanding the javascript you can add multiple filters. eg....
<script type="text/javascript">
function RedirectUrl()
{
var tb = document.getElementById("t
var tb2 = document.getElementById("t
if((tb != nul)l && (tb2 != null))
{
window.location.href="?Fil
}
return false;
var tb2 = document.getElementById("t
</script>
<table width="100%" cellpadding="5" celspaceing="0" border="0">
<tr>
<td style="text-align:right" width="30%">Please enter a search term and click search</td>
<td style="text-align:left" width="175px"><input id="tbSearch" width="150px" type="text" name="T1"></td>
<td style="text-align:left" width="100px">Title : <input type="button" id="btnSearch" value="search" onclick="return RedirectUrl();" />
<td style="text-align:left" width="100px">Company Name : <input type="button" id="btnSearch2" value="search" onclick="return RedirectUrl();" />
</td>
<td style="text-align:left" width="100px"><input type="button" id="btnReset" value="reset" onclick="return RedirectUrl();" />
</td>
<td> </td>
</tr>
</table>