水晶代码编程错误

时间:2011-02-07 19:02:17

标签: crystal-reports crystal-reports-xi

这个公式有什么问题

IF {@year2 number} = 2013 And {@Current Month}='Jan' THEN '- 12' ELSE '- 13'
IF {@year2 number} = 2012 And {@Current Month}='Jan' THEN '- 11' ELSE '- 12'
IF {@year2 number} = 2011 And {@Current Month}='Jan' THEN '- 10' ELSE '- 11'
IF {@year2 number} = 2010 And {@Current Month}='Jan' THEN '- 09' ELSE '- 10'
IF {@year2 number} = 2009 And {@Current Month}='Jan'THEN '- 08' ELSE '- 09'
IF {@year2 number} = 2008 And {@Current Month}='Jan' THEN '- 07' ELSE '- 08'
IF {@year2 number} = 2007 And {@Current Month}='Jan' THEN '- 06' ELSE '- 07'
IF {@year2 number} = 2006 And {@Current Month}='Jan' THEN '- 05' ELSE '- 06'
IF {@year2 number} = 2005 And {@Current Month}='Jan' THEN '- 04' ELSE '- 05'
IF {@year2 number} = 2004 And {@Current Month}='Jan' THEN '- 03' ELSE '- 04'
IF {@year2 number} = 2003 And {@Current Month}='Jan' THEN '- 02' ELSE '- 03'
IF {@year2 number} = 2002 And {@Current Month}='Jan' THEN '- 01' ELSE '- 02'
IF {@year2 number} = 2001 And {@Current Month}='Jan' THEN '- 00' ELSE '- 01'
IF {@year2 number} = 2000  And {@Current Month}='Jan'THEN '- 99' ELSE '- 00'
IF {@year2 number}= 1999 And {@Current Month}='Jan' THEN '- 98' ELSE '- 99'
IF {@year2 number} = 1998 And {@Current Month}='Jan' THEN '- 97' ELSE '- 98'

1 个答案:

答案 0 :(得分:0)

欢迎使用SO,user525552,

放松。你可以完全摆脱这个公式。拖拽将您的日期字段放到报表设计上,然后右键单击>格式字段 - >日期和时间,然后选择您喜欢的显示格式。

修改

根据您的评论,尝试此公式。 (我不相信你确实需要这个公式,但这确实回答了你的直接问题)

Monthname(
    month(
        DateAdd ("m", -4, {?Pm-Command.SCHED_END_DT})
    )
,true)

& "-" &

right(
    cstr(
        year(
            DateAdd ("m", -4, {?Pm-Command.SCHED_END_DT})
        )
    ,0,"")
,2)