Showing posts with label SharePoint Designer. Show all posts
Showing posts with label SharePoint Designer. Show all posts

Thursday, January 2, 2014

SharePoint 2010: Conditionally Format Fields in a List

Hello!

This post will be covering how to use a data view web part to apply conditionally formatting to a list.  You might want to use this technique to create simple heat maps for KPIs or as a visual indicator.  An example of when this could be used is to color code expenses which are valued over $1,000.

Materials Needed:
  1. SharePoint Designer 2010
  2. A web page
  3. A List
  4. Dataview web part

Assumptions:
In this post I will be assuming that you know how to obtain SharePoint Designer 2010, create a blank wiki or web parts page, and have a list already created that you need to conditionally format.

Now that we have all of that out of the way, let us move onto the How To!

  1. Open SharePoint Designer
  2. Open Your Site
  3.  Enter Your Credentials
  4. Open the library where the page you created is stored, this is most likely in the pages or Site Pages library
  5. Right click the page that you created and select “Edit File In Advanced Mode
After opening the page in advanced mode you should be presented with Design, Split, or Code view.  We will let SharePoint Designer do the heavy lifting for this exercise, so select the Design view.

1.    Click into the web part zone that you would like to have your list displayed
2.    Select the Insert Tab on the Ribbon
3.    Select Data View
4.    Select Your List

You should now have your list on the page as a data view web part.  I have created an example list to show how we can use conditional formatting to better visualize our data.  I will be creating a visual heat map only for my Relationship field for the sake of time, but the same concept could be applied to all of my other list fields.


  1. Select your td
  2.  
  3. Select List View Tools
  4. Select Options
  5. Select Conditional Formatting
  6. Select Format Selection

  7. You will be prompted with the Condition Criteria Dialog Box
  8. Select the field you would like the condition based upon.  I will be using my Relationship field in order to create my conditions.

  9. Select the comparison and value which makes sense for your situation.  Since this list is only an example I have created extremely basic criteria.
  10. Select Set Style
  11. This dialog will provide you a list of options which could be used to conditionally format your fields.  I will be setting my Background to match the color of the entry.

You will repeat these steps for each condition that you would like to conditionally format for.  Don’t get confused by the term selection, the formation rules will be applied to all of your line items within the column.  I never had to click another td while creating my rules, the conditions will automatically cascade down.


The last step is to save your changes and to do a refresh!  Go check out your conditionally formatted data view web part!

I hope everyone was able to get this to work and fit their needs.  Please feel free to leave a comment or reach out if you have any questions J

Cheers,

Dan

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, May 10, 2013

How To Hide The Add New Item Link On The Bottom Of Lists & Libraries


How to Hide the Add New Item Link on the Bottom of Lists & Libraries (per view)

Why on earth would we want to hide the “add new item link” on the bottom of lists and libraries!  One very good reason to hide this link is due to multiple content types and the fact that this link will only give the new form for the default content type.  We can have our users submit new items either through the ribbon or navigation that we create.  I will base this tutorial on the example I proposed in an earlier post “An Example of When to Use Multiple Content Types for a List” which essentially has an HR Question Repository with a content type for each HR Question Type being submitted.

In order to hide this link you will need:
  •  SharePoint Designer or a Content Editor Web Part on the page
  • This code snippet

<style>
 td.ms-addnew { display:none; }
 </style>

Steps
1. Open SharePoint Designer
2.Open the List/Library which needs the link hidden
3. Right Click the view you would like to hide the link for
4. Select “Edit File in Advanced Mode”


5. Place the code between your asp:content tags for “PlaceHolderBodyAreaClass”

6. Save
7. View Your Results!

Regards,
Dan



Wednesday, April 3, 2013

Event Content Types Remove Recurrence, All Day Event, & Workspace From Forms


I have had many requests to modify the fields encapsulated within the Event Type and that is typically not an issue.  There are three pieces of Meta Data which seem to be impossible to remove through the site interface, “All Day Event,” “Recurrence,” & “Workspace.”  Although these fields can’t be removed through your site interface, you can hide 1 or all of these fields through SharePoint Designer.
 

Many of the sites I have worked on have requested a Calendar which allows the user to select “All Day Event” & “Recurrence,” but would like to have Workspace Removed. (We will remove it in this example)

 

How to Hide Workspace:

 

1.    Open Designer

2.    Under the sites tab, open the site where the Event Content Type Resides

3.    Under Navigation, select “Content Types”

4.    From the Content Types Tab, select the Event Type which needs to have Workspace hidden

a.    You should now have a tab open with the name of your content type

5.    Select “Edit Content Type Columns” under Customization

 

This is where it can be a bit tricky and you start to realize some of the quirks of SharePoint Designer.

 



When you select Workspace, there is not a dropdown arrow to select the Property Type from the combo box.  This is extremely irritating, but you have to click 3-4 (typically) to the right of the Optional Dialog until you will be presented with the dropdown options

 
You can now select the Hidden Property!  Save your content type and your updates should now be reflected in SharePoint!

 
Regards,

Dan

Monday, April 1, 2013

Linking Lists & Editing The Default Display Form


This post will explain how to create a connection between two lists and then how to display the connection in the display item form. These lists are extremely simplistic, but they will help to visualize the idea. (I apologize for the small screenshots; Blogger does not seem to like my Snagit Shots)

 
Creating a connection between two or more lists can be extremely helpful and for this example I will explain it in terms of Employees and an Employer. If any of you have had to work with database schemas in the past, you will know all too well about data relationships, data integrity rules, and normalization. For those readers who have not had exposure to this yet, here are the cliff notes.


There can be many employees to one employer, so the relationship is a one to many relationship. For the linking of these lists we will want the Employer (Parent) to display all of the Employees (children) when we open the "View Item Form."

To do this we will create two custom lists (the meta data within each list does not matter for this example, but you will need the lookup field)

1.      Employer

a.       Employer Name –title

b.      Employer City – combo box

c.       Phone Number – single line of text

&

2.      Employee

a.       Employee Name - title

b.      Employed By - lookup

c.       Employee Type – radio button

d.      Emergency Contact Number – single line of text



The field which will enable this connection of the two lists is the lookup field


Within the Employees List (Child) select the Lookup field and select Employer (Parent) like I have done in the below screenshot.

 


Now that you have created the two lists, create some dummy data within Employer & Employees so there is data to select from.


I have created three list items in “Employee” linked to “Employed by" Example 1


This view is ok when viewing the data from the Employee list, but what about the view for the “Employer List?”



This view does not show us any of the employees that are linked to example 1, so we will edit the display form to show our related items.


List Tools → List→ Customize List→ Form Web Parts→ Default Display Form

 


From this page go to:

Page Tools→ Insert→ Related List→ Employee

Your View Item Form should now resemble the following



 

Congrats on creating a connection and displaying it in the “View Item Form!”