我在查询中有一个Crystal输出,记录集是:
DATE TIME FLOC VALUE
01/07/2015 AAA
02/07/2015 01:30:00 AAA 00MC
02/07/2015 03:30:00 AAA 00SE
03/07/2015 AAA
04/07/2015 AAA
05/07/2015 AAA
06/07/2015 AAA
07/07/2015 AAA
08/07/2015 08:00:00 AAA 00MP
08/07/2015 14:00:00 AAA 00SE
01/07/2015 BBB
02/07/2015 09:30:00 BBB 00MP
02/07/2015 16:30:00 BBB 00SE
03/07/2015 BBB
04/07/2015 BBB
05/07/2015 BBB
06/07/2015 BBB
我想根据上下文评估创建一个具有先前值的附加列:
FOR same DATE and FLOC
IF TIME <= "04:00:00" THEN CHECK = VALUE
ELSE CHECK = DATE-1 VALUE
获得这样的东西:
DATE TIME FLOC CHECK VALUE
01/07/2015 AAA
02/07/2015 01:30:00 AAA 00MC 00MC
02/07/2015 03:30:00 AAA 00SE 00SE
03/07/2015 AAA 00SE
04/07/2015 AAA 00SE
05/07/2015 AAA 00SE
06/07/2015 AAA 00SE
07/07/2015 AAA 00SE
08/07/2015 08:00:00 AAA 00SE 00MP
08/07/2015 14:00:00 AAA 00SE 00XX
01/07/2015 BBB
02/07/2015 09:30:00 BBB 00MP
02/07/2015 16:30:00 BBB 00XX
03/07/2015 BBB 00MP
04/07/2015 BBB 00MP
05/07/2015 BBB 00MP
06/07/2015 BBB 00MP
07/07/2015 BBB 00MP
08/07/2015 BBB 00MP
01/07/2015 CCC
02/07/2015 22:30:00 CCC 00MC
02/07/2015 23:30:01 CCC 00MC
03/07/2015 CCC 00MC
04/07/2015 CCC 00MC
05/07/2015 23:00:00 CCC 00MC 00YY
06/07/2015 01:00:00 CCC 00SE 00SE
07/07/2015 CCC 00SE
08/07/2015 CCC 00SE
关于如何在Crystal上处理这个问题的任何想法? 非常感谢。 亲切的 S上。
答案 0 :(得分:1)
我已经使用Previous()函数+ EvaluateAfter()作为上下文env。 THX。