Solved

IF OR statement in Sharepoint

Posted on 2014-01-13
8
651 Views
Last Modified: 2016-03-02
Is there a Sharepoint Expert that can help me on this one.

I want to insert traffic lights if certain criterea is met. I have achieved this using single criterea where I set up a column called RAG and a column call Traffic Light, and depending what was in that cell RAG, i.e. R, A or G the Traffic Light will insert the appropriate 'picture' being Red Amber or Green.

What I am now trying to do is include a third dimention but cannot get this to work.

So. my query is ,IF(OR([Status]="WIP",[Status]="Yet to Start",IF([Target Date]<=TODAY(),"<IMG src='http://xxx/yyy/AS/Pictures/_t/kpiryg-2_gif.jpg' />"))

Much appreciate your assistance with this.
Thanks
0
Comment
Question by:Jagwarman
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39776040
Hi,
which SharePoint version and edition?
How do you "insert" the picture?
Can you please explain your logic in more details (and pseudo code)?
E.g. you have a column named Status. If the status equals ... and the datetime value in column XYZ > today then display X, if column XYZ < today then Y ...

Thanks.
Rainer
0
 
LVL 31

Expert Comment

by:Jamie McAllister MVP
ID: 39776174
If you're using SharePoint 2010, this can be done on lists using SharePoint Designer. I've detailed the steps here;

http://the-north.com/sharepoint/post/Replace-Task-List-Status-Column-with-Icons-in-SharePoint-2010
0
 

Author Comment

by:Jagwarman
ID: 39776190
Unfortunately my firm does not allow us to have access to Designer so is there another way of achieving this?

Thanks
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39776198
Hi,
which SharePoint version and edition?
So you do not already have that kind of displaying images implemented, correct?

Without SharePoint designer access, the quickest way would be to use a Content Editor web part and some Javascript/jQuery code to change the column content from text to image.

Thanks.
Rainer
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:Jagwarman
ID: 39776282
I am using 2010
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 39776532
Hi,
OK, I still cannot fully understand your question (especially about the calculated column) but at least for dynamically displaying images here a solution.

Step 1: If you do not already use / have a jQuery library file, please upload one (downloadable from http://www.jquery.com - select a version < 2.0) and upload it to a document library of your site (e.g. assets).
Step 2: Create a text file, paste the following code and adjust the code to fit your needs (e.g. column position and image src urls)
Step 3: Open the page where you display the list, edit the page and add a content editor web part, referencing the under 2. uploaded text file
Step 4: Save and close the page and feel happy

Code:
<script type="text/javascript" src="http://yoursharepoint.local/sites/ee/SiteAssets/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
        _spBodyOnLoadFunctionNames.push("ChangeColumnAddImages");

        function ChangeColumnAddImages() {
			
			var calculatedColumns = jQuery("table.ms-listviewtable tr td:nth-child(6)");
			calculatedColumns.each(function() {
				var imgUrl = '<img src="/_layouts/images/';
				switch(jQuery(this).text())
				{
					case "R":
						imgUrl += 'kpiryg-2.gif" />';
						break;
					case "G":
						imgUrl += 'kpiryg-0.gif" />';
						break;
					default:
						imgUrl += 'kpiryg-1.gif" />';
				}
				jQuery(this).html(imgUrl);
			});
        }
</script>       

Open in new window

The above code will replace the 6th column which contains the calculated value like "R" or "G" and sets the html of each column cell to display the related image.

If you need further help for you calculated formula, please add more info.
Thanks and HTH
Rainer
0
 

Expert Comment

by:Stewart Obis
ID: 41488879
=[M6 Date Expected]&[M5 Date Expected]&[M4 Date Expected]&[M3 Date Expected]&[M2 Date Expected]&[M1 Date Expected]=Today-7   and the complete box is not checked then show "Amber"
=[M6 Date Expected]&[M5 Date Expected]&[M4 Date Expected]&[M3 Date Expected]&[M2 Date Expected]&[M1 Date Expected]=Today+7   and the complete box is not checked  then show "Red"
0
 

Expert Comment

by:Stewart Obis
ID: 41488883
Hi Rainer,

=[M6 Date Expected]&[M5 Date Expected]&[M4 Date Expected]&[M3 Date Expected]&[M2 Date Expected]&[M1 Date Expected]=Today   and the complete box is not checked  then show "Green"

=[M6 Date Expected]&[M5 Date Expected]&[M4 Date Expected]&[M3 Date Expected]&[M2 Date Expected]&[M1 Date Expected]=Today-7   and the complete box is not checked then show "Amber"
=[M6 Date Expected]&[M5 Date Expected]&[M4 Date Expected]&[M3 Date Expected]&[M2 Date Expected]&[M1 Date Expected]=Today+7   and the complete box is not checked  then show "Red"

or

I am doing client side design and development. I don't have access to SharePoint Farm and SharePoint designer (Outsourced). I only have Site level permission (I don't  have Site collection Administrator permission).

KPI (Time) field will create a KPI indicator based on current entered information in the task line (specifically of the milestone expected date fields).


Date Field: KPI (Time)      

Detail:

      KPI (Time) will be triggered from the 6 Milestone Expected Date fields (M1 Date Expected -> M6 Date Expected):
a) If the date required of any of the milestone Expected Date field does is not greater exceed todays date and the complete box is not checked then Project KPI field will = Green

b) If the date required of any of the milestone Expected Date field is greater than todays date (by less than a week) and the complete box is not checked then Project KPI field will = Amber

c) If the date required of any of the milestone Expected Date field is greater than todays date (by more than a week) and the complete box is not checked then Project KPI field will  = Red

Each of our 6 milestones have a date expected and completed (as per the new fields required above). The overall KPI will look across all the milestone date expected fields and generate the KPI status based on any overdue and by how long.

Kindly help.

Stewart
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Microsoft SharePoint Foundation 2010 and Microsoft SharePoint Server 2010 do not offer the option to configure the location of the SharePoint diagnostic trace log files during installation.  This can, however, be configured through Central Administr…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now