locked
How to Reduce the current date by 2 days in Sharepoin designes RRS feed

  • Question

  • I am using the code in Conditional formatting of the SharePoint designer

    ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($thisNode/@DueDate))) = ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($Today)))

    to check the Due date with the current date.

    But I want to check the Due date with the current date less than two days.

    I am Sharepoint Beginer please help me.


    Reason :

    I want to make the Title as yellow to make the First remainder

    Wednesday, November 13, 2013 8:09 AM

Answers

  • SharePoint's XSLT has some limitations around date functions. For your specific purpose, it would be easier to create a Calculated Column on the list to do the date -2 calculation, and then base your conditional formatting on the new calculated column.

    Dimitri Ayrapetov (MCSE: SharePoint)

    • Marked as answer by Sriharsha d Monday, December 2, 2013 4:12 AM
    Sunday, December 1, 2013 7:39 PM

All replies

  • SharePoint's XSLT has some limitations around date functions. For your specific purpose, it would be easier to create a Calculated Column on the list to do the date -2 calculation, and then base your conditional formatting on the new calculated column.

    Dimitri Ayrapetov (MCSE: SharePoint)

    • Marked as answer by Sriharsha d Monday, December 2, 2013 4:12 AM
    Sunday, December 1, 2013 7:39 PM
  • Hi DimitriAyrapetov,

    Thanks for the reply. but I am using the condition formatting But unable to use the condition that the calculated value is not visible.

    thanks in advance.hope you will reply soon

    Monday, December 2, 2013 4:15 AM
  • Hi Sriharsha, you are right that the calculated field needs to be part of the CAML field list. However, after building your query that includes the calculated field, you can delete the table column that you don't need, which will remove it from the presentation but retain it in the CAML query.

    Dimitri Ayrapetov (MCSE: SharePoint)

    Monday, December 2, 2013 4:28 AM
  • Dear DimitriAyrapetov,

    But if We delete the that table column We cannot get it updated automatically right.

    For Example take a case: I want format the Title feild depening on the data Feild

    If the Date is

    • less than two days ->title yellow color.
    • after date ->Red color.
    • Others -> Green Colors.

    Please help

    Thursday, December 5, 2013 11:35 AM
  • Can you rephrase your question about getting it updated automatically?

    There are two components in your list view, one is the CAML query that returns the required fields, the other is the presentation layer that allows you to display the fields. Conditional Formatting requires that the CAML query has the proper fields, whether or not they are on the presentation layer doesn't make a difference. If you add the calculated column to your Fields list, and then delete the column (which will remove it from the presentation layer), your conditional formatting should be able to work as you intend.


    Dimitri Ayrapetov (MCSE: SharePoint)

    Thursday, December 5, 2013 2:05 PM