Monday, November 18, 2013

How to Modify the Text Filter Web Part to Allow Partial Searches (SharePoint 2010)

Hello!  If you are reading this, I am assuming that you were dramatically let down by the Text Filter Web Part as well (shakes fist at the sky).  I have no idea why Microsoft thought that only allowing exact string / text matches was a great idea for the text filter web part, but the reality is that the web part needs the flexibility to handle begins with clauses, contains, etc., and the good news is this article is how to do exactly that!

Materials Needed:

SP Designer 2010

A Web Page containing:

            The Text Filter Web Part

            Data View Web Part

By searching for this article, I am assuming that you already have a web page set up which has the text filter web part on it, so we will start the tutorial on this premise.


Starting Point:
1. Open designer

2. Open your page in advanced edit more

a. Right click and select edit in advanced mode

3. Select the split view

 
4. In the desired zone, select the data view of the list you are trying to filter off of the insert tab

a.  



 
b.  
 
 
5. Select the list you added to the page

6. Select Options

7. Select Filter

8. You will be presented with the following dialog box (select your field that you would like to filter and set your comparison to Contains or Begins With depending on your needs)

a.  



9. Select Create a new parameter

a. Rename Param1 to a name of your choosing, I will be using “FilterExample”

b. Select Query String under Parameter Source

c. Select Ok


10.Right Click Text Filter Web Part In Designer

a. Select Add Connection

b. Select Send Filter Values To

c. Select Next

d. Select Connect to a web part on this page

e. Select Next

f. Select the list you put on the page as your Target Web Part

g. Select Get Parameter From as the Target Action

h.  



i.    



j. Select Next

k. Select Finish

11.Save The Page

12.Select Yes to the dialog box

Now that you have completed the steps, the Text Filter web part should now allow partial searches of the desired field.  For this example I set my Text Filter to use contains on the Title field.  Since I defaulted my variable to not contain anything, the page should be blank to start.


After I put in the letter T and hit enter, it will filter my list and find any items containing the letter.


Cheers!
Dan

Friday, November 15, 2013

Corrupt / Broken Web Part No Worries! How to Access the Web Part Maintenance Page


I haven't had to use this trick in a while, but I ended up having to remember it today, so I figured I would write quick blog post on it.

From time to time a web part can become corrupt or broken making it impossible to delete, edit, remove, etc from the page.  This can be an enormous headache and a very annoying scenario when you first encounter it.  The easiest way to remove the broken web part is by utilizing the web part maintenance page.  To access the page, simply put “?contents=1” at the end of your URL.  For example if my page was:

us/sitename/pages/ExamplePage.aspx

I would use us/sitename/pages/ExamplePage.aspx?contents=1 to access the web part maintenance page.  From this page you can easily see which web parts are being used on the page and easily delete the one(s) that are corrupt or broken.

Cheers!

Dan

Wednesday, November 13, 2013

How to Clear Your SharePoint Designer 2013 Cache


This quick tutorial will cover how to clear your SPD 2013 Cache, which comes in handy especially when working with SPD 2010 & SPD 2013.  Clearing the cache will remove any of your past connection history as well give you a “clean slate” to work from.  The cache is not even cleared after doing a reinstall, so this really is the only way to clear it.

Steps:

1.    Close SPD if it is open

2.    Open My Computer

a.    Click the address bar

3.    Paste %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache

4.    Delete everything within this location

5.    Click the address bar

6.    Paste %APPDATA%\Microsoft\Web Server Extensions\Cache

7.    Delete everything in this location

 
This is a quick couple of steps in order to clear your cache and to hopefully resolve SharePoint Designer anomalies which present themselves from time to time.

Cheers!

Dan

Thursday, October 17, 2013

How to Create an Export to Excel Button for Any List & View (Including Surveys)


This tutorial will cover how to create a simple HTML button which will export a particular list & list view to Excel.


Materials Needed:

<input type="button" style="width:180px; height: 75px; 30px;background:gray; color:white;font-size:larger; font-weight:bold;"onclick="window.location.href='SITEURL/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={YOUR LIST ID}&View={YOUR VIEW ID}&CacheControl=1';" value ="YOUR BUTTON TEXT"/>


The code above is essentially everything that you will need for a simple Excel Export button.  In order to get the code to work, you will need to update the SITEURL, YOUR LIST ID, YOUR VIEW ID, & YOUR BUTTON TEXT.


The hardest part of this exercise is to determine what your list & view ID are, but even that is simple!


To Obtain Your List & View ID:


1.    Navigate To Your List

2.    Select List Settings

3.    Under Views

a.    Edit the view you would like to create an export button for

4.    Copy The URL from your browser

a.    It should resemble: SitePath/_layouts/ViewEdit.aspx?List=%7B58B38FF2%2D9F99%2D4279%2DA22C%2DA2CCA95F4D7E%7D&View=%7B5781F798%2DD539%2D4015%2D87FB%2DA4A32925AACC%7D&Source=%252Fsites%252Fustsm%252F%255Flayouts%252Flistedit%252Easpx%253FList%253D%25257B58B38FF2%25252D9F99%25252D4279%25252DA22C%25252DA2CCA95F4D7E%25257D

b.    You can manually break out the View= & List=, but I personally just use this free translator that is embedded in the page which does it for you.


 

To Implement The Button:


1.    Swap out the necessary snippets in order to update the HTML code (YOUR BUTTON TEXT, YOUR URL, YOUR LIST ID, and YOUR VIEW ID) with the information you obtained in “To Obtain Your List & View ID.”

2.    Place the updated code into a text file and save it out on your site

3.    On a webpage that you would like the button, create a content editor web part and link that web part to the URL of your text file, I would recommend using the relative path (/local/fakesite/library/filename.etc).
 

That’s It Folks!


Dan

 

Friday, September 27, 2013

InfoPath Tutorial Cascading Dropdown (Does not have the 20 item limit)

I had read a number of tutorials on how to create a cascading dropdown using InfoPath 2010, but there was a 20 item limit (which is not very useful).  The lists I implemented this for actually have just under 5,000 items in order to not breach the threshold limit.  If you do have a list with over 5,000 items, the lookup column will not work until you raise the threshold limit to be above 5,000 items in Central Admin.

This post will explain how to create a cascading dropdown within InfoPath 2010 for a list content type.

Example Situation:  I am going to create a contact form which will filter the territories based upon the region of the form and then when I select the territory it will filter my store numbers to only show that territory’s stores.

My Hierarchy:

            Region
                       →Territories
                               → Store Numbers
Materials Needed:
SharePoint 2010 List Which Utilizes a Two Lookups
A SharePoint 2010 Content Type
InfoPath 2010
 
First we will need to navigate to the list:

1.    Open Your List

2.    Select List Tools

a.    Select List

3.    Select List Settings

4.    Select Form Settings Under General

5.    Select Your Content Type

6.    Select “Customize the current form using Microsoft Infopath”

This will open InfoPath with that content type’s fields.  We are modifying the form for this specific content type; we are not modifying the list form.

The next step is to create and style the form to meet your needs, for this example I created this from.





My form currently is displaying all of Mountain Store ID’s when in reality I only want the ID’s shown for that specific territory.

To create the cascading dropdown:

1.    Right click your child lookup field and select “Dropdown List box Properties…”

a.    

2.    The next step is to select Add…  We will be creating a new data source in order to implement our cascading dropdown

3.   


4.    


5.      


6.    Your URL for the site should be selected in the next screen

7.    Select the child list which your lookup pulls from.  In my example, my Mountain Store ID comes from my Mountain Region list.

8.    Step 9 is really what makes this entire thing work.  The default data connection only pulls the Mountain Store ID (aka Title) in the source list.  The new data connection will allow us to query the list to obtain additional data.  For our example I will be selecting Title & Territory since I will want to filter my ID’s down by the Territory.
       9.
10. Select Next

11. Select Next

12.   In step 13, make sure to DESELECT Automatically retrieve data when the form is opened.

13.
      14. Select Finish

15. Now that we have created the new data source, we need to switch the value to ID otherwise we will run into validation errors later.

16. 

17. Select OK

Now that the new data source has been created, we can use it to create our cascading dropdown!

1.    Select your parent field, in my case this field is territories.  (All of my store ID’s are tagged with the Territory they correspond with in the Mountain Region List)

2.    Select the Home Tab

3.    Select manage rules

4.    Select add rule

5.    Select New

6.    Select Action

7.    Within your rule, select Add “Set a fields value”

a.    We are going to set our Mountain Store ID to default to blank

b.     

8.    Create another Set Field Value Action.  In this action we will be setting our form to filter our Mountain Store ID’s based upon the territory.

9.    We are going to set this action to set our Territory to our newly created Data Sources Territory.

10. Select the fields icon next to the Field: dialog box 
 
11. A similar menu should appear like the one below:

12. 

13. Select the dropdown arrow and select the data source you just created.  In my example, it

14. is Mountain Region1

a.     

b.    Open Query Fields

c.     Open q:SharePointListItem_RW

d.    Select the field which corresponds with your parent field.  In my example, it is Territory

e.     Select OK

15.   We now need to set the value for the second parameter of the Rule Details.  Select the fx button and select your parent field from the main data source.

16.


17.


18. Select OK for all of the dialog boxes after you have selected your parent field from the main data source for the Value: input.

The last step to make this work is to query for data within the rule.  So once again, lets select Add Action, just like we did to set the ID initially to blank and to set the Territory = Territory.

1.    Select Add next to Run these actions

2.    Select Query for Data

3.    Select the Data source you created earlier from the dropdown box.

a.     


4.    Select OK

5.    Your final rule should have the 3 actions and resemble the below

a.     





Well that’s it Folks!  If you have followed the above steps correctly, you should now have a cascading lookup field!

Example For When I Select Denver

 
Example for When I Select Salt Lake
 
Cheers!
Dan
 

Thursday, September 26, 2013

How to Embed A PDF into A Webpage

This post will be relatively quick, since the ability to present a PDF file in a webpage within SharePoint is easy!

Materials Needed:

1.    A Text File .txt

2.    Content Editor Web part

3.    A SharePoint Page

The first step to showing the PDF within a webpage is to store the PDF on your SharePoint site where users will be able to access it.  Once you have uploaded your PDF copy the URL for the newly uploaded PDF file.

After you have uploaded the file, create a new text .txt document in Notepad.  Insert the below code into your text file, but replace the “Your URL HERE” with the URL of your PDF File.  Make sure to leave the “  “at each end since that is needed.


<embed src="YOUR PDF URL HERE.pdf" style="width: 100%!important; height: 1000px!important;style="z-index:-5;" scrolling="no" frameborder="no" allowtransparency="true">


Now that the file has been created, store the text file somewhere on your SharePoint site so we can link a content editor Web Part to it.

 

Place the content editor Web Part on your page and link it to the text file that you just uploaded, apply the changes, and save the page.  You should now your PDF within the browser!


 
Cheers!

Dan