Solved

IF OR statement in Sharepoint

Posted on 2014-01-13
8
670 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pimping Sharepoint 2007 without Server-Side Code Part 1 One of my biggest frustrations with Sharepoint 2007 in the corporate world is that while good-intentioned managers lock down the more interesting capabilities of Sharepoint programming in…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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

24 Experts available now in Live!

Get 1:1 Help Now