基于水晶日期的记录选择;直到星期六没有下个日期

时间:2018-10-25 00:59:26

标签: crystal-reports date-range

我想设置一个带有默认日期范围的Crystal报表用于记录选择。我希望基于公式字段{@Calc Promise Date}的日期范围在当前一周的星期六之前没有更低的日期。我是Crystal的较轻的最终用户,对此有麻烦。

我可以使用:

{@ Calc Promise Date} in AllDatesToToday

但是我正在寻找一种方法来将结果显示为当前星期的所有星期六。

预先感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

感谢西瓦(Siva)在类似问题上的帮助,我现在为这个问题提供了答案。 制作一个新的“结束日期”公式字段,其中包含:

if DayOfWeek (DateSerial(Year(currentdate),Month(currentdate),Day(currentdate))) = 1
then DateSerial(Year(currentdate),Month(currentdate),Day(currentdate)+6)
else if DayOfWeek(DateSerial(Year(currentdate),Month(currentdate),Day(currentdate))) = 2
then DateSerial(Year(currentdate),Month(currentdate),Day(currentdate)+5)
else if  DayOfWeek(DateSerial(Year(currentdate),Month(currentdate),Day(currentdate))) = 3
then DateSerial(Year(currentdate),Month(currentdate),Day(currentdate)+4)
else if  DayOfWeek(DateSerial(Year(currentdate),Month(currentdate),Day(currentdate))) = 4
then DateSerial(Year(currentdate),Month(currentdate),Day(currentdate)+3)
else if  DayOfWeek(DateSerial(Year(currentdate),Month(currentdate),Day(currentdate))) = 5
then DateSerial(Year(currentdate),Month(currentdate),Day(currentdate)+2)
else if  DayOfWeek(DateSerial(Year(currentdate),Month(currentdate),Day(currentdate))) = 6
then DateSerial(Year(currentdate),Month(currentdate),Day(currentdate)+1)
else if DayOfWeek(DateSerial(Year(currentdate),Month(currentdate),Day(currentdate))) = 7
then DateSerial(Year(currentdate),Month(currentdate),Day(currentdate)+0)

然后在“记录选择”中引用该公式。就我而言,记录的相关日期范围是“通过当前日期范围”公式字段,因此我的“记录选择”随后被更新为包括以下行:

{@Through Current Date Range}<{@End Date}