0

Here is my formula:

if Maximum({@tx plan date}, {CDCLIENT.SORT_NAME})=Date (1999-01-01) then 
  currentdate-Maximum ({CDASSFRM.DATE_EFFECTIVE}, {CDCLIENT.SORT_NAME}) 
else 
  Maximum ({@tx plan date}, {CDCLIENT.SORT_NAME})-Maximum ({CDASSFRM.DATE_EFFECTIVE}, {CDCLIENT.SORT_NAME})

The above formula is now getting a string is required error on the field =Date(1999-01-01) part. I don't seem to be able to figure what is needed

4

2 回答 2

0

使用任一:

if Maximum({@tx plan date}, {CDCLIENT.SORT_NAME})=Date(1999,01,01) then 
  currentdate-Maximum ({CDASSFRM.DATE_EFFECTIVE}, {CDCLIENT.SORT_NAME}) 
else 
  Maximum ({@tx plan date}, {CDCLIENT.SORT_NAME})-Maximum ({CDASSFRM.DATE_EFFECTIVE}, {CDCLIENT.SORT_NAME})

或者:

if Maximum({@tx plan date}, {CDCLIENT.SORT_NAME})=DateValue("1999-01-01") then 
  currentdate-Maximum ({CDASSFRM.DATE_EFFECTIVE}, {CDCLIENT.SORT_NAME}) 
else 
  Maximum ({@tx plan date}, {CDCLIENT.SORT_NAME})-Maximum ({CDASSFRM.DATE_EFFECTIVE}, {CDCLIENT.SORT_NAME})
于 2013-06-27T14:27:53.830 回答
0

要在 Crystal 报表中声明日期,您可以使用哈希:

Date (#1999-01-01#)

编辑

当您尝试与 s 字符串进行比较时,您需要将字符串转换为日期,反之亦然(可能需要测试和使用日期格式):

if Maximum({@tx plan date}, {CDCLIENT.SORT_NAME})= "1999-01-01" then ToText(currentdate-Maximum ({CDASSFRM.DATE_EFFECTIVE}, {CDCLIENT.SORT_NAME}),"yyyy-MM-dd") else 
Date(Maximum ({@tx plan date}, {CDCLIENT.SORT_NAME}))-Maximum ({CDASSFRM.DATE_EFFECTIVE}, {CDCLIENT.SORT_NAME})
于 2013-06-27T13:12:48.610 回答