Using Nintex to perform conditional formatting in a SharePoint list

  • 19 February 2015
  • 17 replies
  • 10 views

Badge +11

I am using Nintex Workflow and SharePoint 2010.

 

I have date1 and date2. There are occasions when date1 may be 'N/A'. If date2 - date1 > 30 days the ROW for that item will be one color. If date2 - date1 <= 30 days the ROW is another color and if date1 = 'N/A' it will be another color. How can I do this in a workflow. I was going to do it in SharePoint Designer and I couldn't figure out how to do it there either.


17 replies

Userlevel 7
Badge +17

If you need the conditional formatting on the List View, then the traditional way in 2010 is to use a DataView in SharePoint designer. You could use a workflow to support this by doing the formula for you and assigning a value to a custom field to mark the color, but this can be accomplished in the DataView without it. A calculated field on the list item can probably accomplish the same thing a workflow calculation.

Badge +11

As the expert, which way would you do it? wink.png

Badge +11

I've done conditional formatting before. However, it was just based on another field's value not the calculation of two fields. And I didn't format the whole row just a single cell.

Userlevel 7
Badge +17

I'd upgrade to 2013 and use a display template!! happy.png

But in 2010, I probably would not use a workflow unless I couldn't get the value(condition) I needed for the DataView.

Userlevel 7
Badge +17

I didn't think of this at first, but even in 2010 you can use JQuery to change styles of elements. Review this if it is an option.

here is an example I found

$('input[type=checkbox]').change(function(){

    if($(this).prop('checked')){  

        $(this).parent().css('backgroundColor', '#bff0a1');

    }else{

        $(this).parent().css('backgroundColor', '#eee');       

    }

});

This example shows that you can query for an element based on attributes and then change the selected element's styles.

Badge +11

Unless I'm missing something, I don't think this will work. This is based on a SharePoint date field subtracting the current date then formatting the color. Based on the results of the calculations it will then determine the color. This thing has been on my nerves for TWO days. I'm now ready to throw my PC across the room! To make things worse, SharePoint Designer shows different results than the browser does! Ughhh!

Userlevel 5
Badge +12

Hi Lisa,

 

Here is maybe and idea (please let me know more about what you need to do if I am way off here):  Inside of your workflow perform the date calculation.   Have another column that you can update with the color that you want this row to be as a result of your date calculation.  For example:  Column named "Color"  specify "Red"   then have whatever code you are using to change the row column color to be based on the color specified in this column.

 

Hopefully this helps?

Mike

Badge +11

Hey Mike,

Hmmmm....this is something to try. I'll take a look and let you know Mike. Thanks!

Lisa

Userlevel 7
Badge +17

I hope that didn't hold you up, I mentioned that on the 19th. happy.png

The jquery could perform the calculation for you and then set the color, or look for a color value in a field and then set the color it wouldn't matter. I believe both possibilities could be accomplished with a dataview webpart as well.

Userlevel 5
Badge +12

No problem, just trying to save one computer/monitor at a time. happy.png

Badge +11

No....I was so into working this darn thing I hadn't logged into the community for a few days.

Badge +11

I got this to work. I added a SharePoint column for the number of days. I did the calculation in Nintex and set the number of days field. In SharePoint Designer, I did the conditional formatting based on the number in the number of days! Simple! I don't know why SharePoint Designer had such a problem handling it. I had to deal with Ticks (what the heck) and all this other stuff when I tried calculating in Designer! Doing it this way was way easier.

Userlevel 5
Badge +12

Awesome, I was going to say you could do it exactly as you did it, rather than using color words, so great job!

Userlevel 7
Badge +17

Show us the screenshot!

Badge +11

color.jpg

Badge +11

SPColor.jpg

Badge +11

colorworkflow.jpg

Reply