Thursday, June 30, 2011

Add image to custom list with calculated / conditional column.

This is the method, I followed to achieve – add image to custom list with calculated / conditional column.


Following is the result list (check Status Icon column)

  • Diff is a calculated column based on Col1 and Col2
  • It compares values of Col1 and Col2 , if Col2 > Col1
    Diff gives us “1″ and if Col1 < Col2 then it gives us “0″
=IF(Col1<=Col2,”1″,”0″)   is the formula I have used

  • My AIM is to get “Green” signal when Diff = 1 and “Red” when Diff = 0
  • Here I have used KPI icon but we can use any image.
  • Download following images on your desktop 

  • Navigate to your site > Picture Libraries
  • Select Shared Pictures > Upload > Browse
  • Select icon image file and upload it to the Share Pictures library
  • Click the icon image displayed in the Share Pictures library.
  • Click the Preview image displayed on the next screen to view the image itself.
  • Copy the Image URL
  • Navigate to the List you want to have the icons displayed in.
  • List Settings > Create column
  • Provide Following details for the column
  • Column name – Status Icon
  • Column Type – Calculated (calculation based on other columns)
  • The data type – Single line of text
  • Add it to default view
  • This is the conditional “IF” formula I have used 

After adding above formula list will look like

  • And finally to convert HTML DIV tag to image we have to add following JavaScript which will call the image from the Shared Picture and display it column.
  • Add following JavaScript to Content Editor Web Part after List.
Found following script from
http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html
to write HTML in to calculated column and convert HTML tag to IMAGE
 
Make sure to add this script in CEWP after list.
Feel free to reach me in case of any doubts.

Friday, June 10, 2011

Unable to edit Content Editor Webpart – Error on page

Issue
While moving the Content Editor Webpart from one place to another We get the following error message “Error On page” on the Bottom left of the IE.
Or
After moving the content Editor Webpart, when we click Exit edit mode. It gives “Unexpected error has occurred”
Cause
This usually happens whenever we copy the HTML code from one Content Editor webpart to another, due to which the Webpart ID is also copied and it conflicts.
Resolution
Modify the Content Editor Web part
Open the Source Code
Remove the following Tag from the code for e.g.:- ”id=WebPartWPXX WebPartID=”XXXX-XXXX-XXXX-XXXX-XXXXXXXX
Let me know in case of any doubts.

Ordering of Announcements List and Web Part in SharePoint 2010

Scenario:
My colleague is placing announcements on the home page of her SP 2010 site.  When she places a new one, it appears at the top and pushes the new ones down.  She wants them listed in chronological order, new at oldest top, newest bottom. And she wanted the announcements always show newest last and oldest first.
Resolution:
 In Announcement List
  • Go to the announcements list
  • In the ribbon click on “List”
  • In the Views Section click edit this view
  • In sorting section change the sorting method from Descending to Ascending.
In Announcement Web Part
  • In Announcement web part select modify shared web part for the current view
  • Selected View
  • It should be on current view
  • Click on edit the current view option and then again sort the view with ascending order
Please let me know in case of any queries.

Internet URL auto redirects to Intranet URL

Issue:
Company’s internet site auto redirects to Company’s Intranet site
Scenario:
Company’s intranet Site:              http://abc
Company’s internet Site:              http://abc.xyz.com
One user had added Link Web Part on site and in that link web part when he clicks on http://abc.xyz.com  it auto converts into http://abc  in the web part and internet user is not able to access the site. If he manually changes the URL from http://abc to http://abc.xyz.com then it’s working fine.
Resolution:
I did very basic troubleshooting and the issue got resolved.
  • First I went to Central Administration > Operations > AAM settings and checked zone settings for the affected sites. It was looking good.
  • Then I went to IIS manager and found that our developer had put redirection URL under Home Directory of that site.
  • It was obviously for testing purpose but after testing he did not remove it.
  • So I just changed the option to “A directory located on this computer” option and it was working fine as expected.
Feel free to reach me if you have any doubts.

Popular Posts

Disclaimer

The opinions expressed on this blog are the personal views of Pratik's SharePoint Blog, and do not represent or reflect the viewpoints or policies of any past, present, or future employer, colleague, or customer, or any other entity. The posts on this blog are provided ‘as is’ with no warranties, express or implied, and confer no rights. Use of information contained within this blog, including specific technical steps mentioned herein, is at your own risk. References to specific software products, processes, resources, or companies do not imply any endorsement.