3 Replies Latest reply: Jun 23, 2016 12:01 AM by Sunny Talwar RSS

    Calculated field will not return correct value for difference between dates.

    Emmanuel Robles

      Hello All,

      I'm having an issue with a calculated date field where I need to return the difference between two dates, a Release Date and Delivery Date. I have scripted it and I am getting a variety of results with the majority not being correct. I have designed it to return the actual value when it is a positive value and I wan it to subtract the delivery date from today if the value is negative. In the case that the number value is 0 I want it to return 0. How should I format the date while pulling it in and should I calculate it via set analysis on the presentation layer? I have listed the script, if anyone could provide some advice on how I can address this it would be truly appreciated. Thank you in advance.

       

      if(num(Date.4.Release-Date.2.Delivery)<=0, num(Today()-Date.2.Delivery,'#,##0'), num(Date.4.Release-Date.2.Delivery,'#,##0')) as Layover