In Crystal 8.5, you need something like this
DateDiff ("d", {DLY_ACTIVITY.ACTIVITY_DT}, SO_DATE)
This gives the difference in days, there are other options. Getting the two dates in the same section is not so straightforward, it depends on your data. You do have Next and Previous commands for records, or you can group and find the maximum and minimum values.
If there is only one "SA" and one "SO" per group (assuming you are grouping), then you could just use the next or previous function:
if {table.groupfield} = next({table.groupfield}) then
next({DLY_ACTIVITY.ACTIVITY_DT})-{DLY_ACTIVITY.ACTIVITY_DT}
Another option would be to add the table twice and for one table limit the activity types to "SA" and for the other, limit the types to "SO". Then you could easily subtract the two.
If you have multiple instances of each type, you might want to try the second approach and compare maximums or minimums of each field, although it's hard to tell what your goal is here. Maybe provide more sample data and explain what you are trying to achieve.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.