0

I am a newbie to crystal reports, I have a crystal report for which I have a data source from which I am using some fields on to the report.

Crsytal Report Name : InventoryReport

Data Source : I am giving Stored Procedure -- GetInventoryData

Fields : ItemID, ShippedDate, ItemName

I have to get all items which are shipped in between FromData and ToDate of ShippedDate, so I am using formula {GetInventoryData;1.ShippedDate} in {?FromDate} to {?ToDate}

dataType of Shipped Date is String and I have to convert to Date as it needs to be compared but I am having issues in that...

ShippedDate value will be : 2011-04-19 16:02:14.0000000

I have to convert at crystal reports side only..

Please help me how can I cast it to date

4

3 回答 3

1

实际上最好不要使用该公式....在使用上述日期范围的选择公式中

date(split({GetInventoryData;1.ShippedDate}," ")[1]) in {?daterange}
于 2013-04-04T15:16:23.247 回答
0

一种方法...创建一个名为 cvtDate 的公式

date(
tonumber(split({GetInventoryData;1.ShippedDate},"-")[1])
,
tonumber(split({GetInventoryData;1.ShippedDate},"-")[2])
,
tonumber(split({GetInventoryData;1.ShippedDate},"-")[3])
)

然后而不是创建两个日期参数.. 只创建一个名为 daterange 的允许值选项下的范围值然后选择公式将是

{@cvtDate} in {?daterange}
于 2013-04-04T15:10:34.140 回答
0

如果您使用的是字符串,您可以做一个简单的小于或大于之类的操作:

...where ShippedDate >= '2011-04-19 00:00:00' and ShippedDate <= '2011-04-19 23:59:59'

这就像:

...where ShippedDate >= '<from-date> 00:00:00' and ShippedDate <= '<to-date> 23:59:59'

这会起作用,您不必选择约会。

您也可以用作(如果它适合您):

...where ShippedDate >= '<from-date>' and ShippedDate <= '<to-date>'
于 2013-04-04T14:37:01.973 回答