This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.
The SmartForms Day Difference Expression Functions logic has changed between February CU and August CU. Positive values are no longer being returned, instead negative values are being returned.
When using the Day Difference expression you will notice that the returned results between February CU and August CU are not the same.
This issue could be seen from February CU throughout the following February CU Fix Packs until February Fix Pack7 where this issue had been rectified and the correct values are being displayed.
The explanation below is based on the below screenshot.
A Scenario was reproduced using Day Difference (DATE LOGGED, CURRENT DATE) (this can be seen on the left in the screenshot) and Day Difference (CURRENT DATE, DATE LOGGED) (this can be seen on the right in the screenshot).
In this scenario these values were used as input:
Logged Date = 2017-11-30
Current Date = 2017-12-01
*Day Difference should be ( -1 ) for Day Difference (DATE LOGGED, CURRENT DATE)
*Day Difference should be ( 1 ) for Day Difference (CURRENT DATE, DATE LOGGED)
Scenario Results - Day Difference(DATE LOGGED, CURRENT DATE)
The scenario had been tested on a clean 4.7 environment first where the result was -2 (this was an issue as the value returned was incorrect, therefore the issue had been dealt with in February CU)
The second test was with 4.7 + Feb CU where the result was 1 (this was still an issue as this value was still not correct)
The third test was with 4.7 + Feb CU + Feb CU FP1 where the result was 1 (this was still an issue as this value was still not correct therefore this issue had been dealt with in February CU Fix Pack 7)
*A Fix for the above issue has been created and implemented in the February CU Fix Pack 7.
The fourth test was with 4.7 + Feb CU + Feb CU FP1 + Feb CU FP7 where the result was -1 (the correct value had been returned when looking at this (Day Difference(DATE LOGGED, CURRENT DATE)) specific format of the expression being used)
The fifth test was with 4.7 + Feb CU + Feb CU FP1 + Feb CU FP7 + Aug CU to confirm that the fix had been carried over to the newer CU's, the result was the same as with February CU Fix Pack 7 meaning that the fix had been implemented in the February CU Fix Pack 7 and all CU's after that.
Scenario Results - Day Difference(CURRENT DATE, DATE LOGGED)
Now looking at the same function with swapped values we can see that the calculation had been returning positive values (in the scenario you will not see it as a value of 1).
Should you encounter this issue where the returned value is -1, please note that it is merely a design rectification that would be needed where the recommendation would be to swap your input values for the Day Difference expression in order for the calculation to calculate the correct value in a positive.