1

In SharePoint List I need help on below point :-

If Balance Qty is not 0 then it should be in RED color (OPEN) and if Qty is 0 then color should change from Red to Green (CLOSE).

enter image description here

user3760253
  • 663
  • 5
  • 14
  • 25

2 Answers2

1

There is a pretty simple solution and it is totally based on calculated column.

Steps:

1) Create a calculated column named Status

2) Specify the following formula:

=IF(NOT([Balance Qty]=0),"<span style='color:red'>OPEN</span>","<span style='color:green'>CLOSED</span>") 

It is assumed that Balance Qty column exist

and set (important) Data Type to Number or Currency or Date and Time as shown on figure below

enter image description here

Result

enter image description here

Vadim Gremyachev
  • 42,498
  • 3
  • 86
  • 167
  • 1
    Sir You are the Best :). Thanks to provide this supper and simple solution. I was trying from last two days for this with JS,CQWP,XSLT etc etc. Thanks again.:) – user3760253 Oct 29 '14 at 05:52
  • Hi Vadim, Here after saving the data its showing perfect but when I'm trying to filter the status with OPEN or CLOSED its showing the formula instead of OPEN/CLOSED option. – user3760253 Oct 29 '14 at 06:23
0

Please have a look at below:

Client-Side Rendering/JS Link documentation?

The most important is the code samples available for Client Side Rendering (JSLink)

Client-side rendering (JS Link) code samples

You do not need to deploy it via Visual Studio.. Instead place the JavaScript file in any of the libraries and go to Web Part Properties -> JSLink property -> Give path to your JavaScript file.

You can use the first example given in the code samples to achieve the color-coding.

Arsalan Adam Khatri
  • 14,531
  • 3
  • 36
  • 59
  • Hi Arsalan, Is there way to do this through conditional formatting. Because I'm not good in JS. – user3760253 Oct 27 '14 at 10:59
  • Unfortunately conditional formatting and SharePoint Designer view features were taken out, the replacement as I see it was JSLink. The example should make it easy, isn't it? – Arsalan Adam Khatri Oct 27 '14 at 12:17
  • My above question I thought it will be very simple "its one line question" but now its really little difficult for me as I'm using SharePoint online small. – user3760253 Oct 27 '14 at 12:30
  • Requirement can be one-liner, solution may not :). You can checkout the page and try to play with the Web Part with some JS. The first example from code samples is exactly what you are looking for, let me know if you need help. – Arsalan Adam Khatri Oct 27 '14 at 12:36
  • Hi Arsalan, I went through the site and the link which you provided is really good, below one is little close to above question. https://code.msdn.microsoft.com/office/Client-side-rendering-code-0a786cdd , but still not able to meet the requirement because of my less knowledge of JS. It will be really helpful if you look into this – user3760253 Oct 28 '14 at 05:59
  • What have you tried so far, please share.. Also tell me the internal name of the column "Status" – Arsalan Adam Khatri Oct 28 '14 at 09:49
  • Thanks Arsalan, STATUS is choice column type. (OPEN/CLOSE) which should change automatically as per the Balance Qty. Above link which I've copied (provided by you) in switch case I changed from High to OPEN and LOW to Normal this will work if I select status manually.However the requirement here is if Balance Qty is not equal to Open Qty then STATUS should be automatic(Not manually) change in (OPEN - RED color) and If its equal to Open Qty then STATUS should be automatic change to (CLOSE-GREEN COLOR). – user3760253 Oct 28 '14 at 10:48