2012-09-05 403 views
2

我一直試圖找不到一種方法來篩選出報告中的記錄。 我有一個標題爲time_period的字段,以「MM/YYYY」格式返回日期。 我有兩個參數,分別是「MM/DD/YYYY」中的startMonth和endMonth。Crystal Reports中的切換日期格式

不知何故,我需要能夠確保date_grouping字段值介於兩個參數之間。

這裏是我迄今爲止...

{location_total_kpi_view.time_period} >= 
Date(Month({?startMonth}) + Year({?startMonth})) and 
{location_total_kpi_view.time_period} <= 
Date(Month({?endMonth}) + Year({?endMonth})) 

它排除了所有記錄。有什麼建議麼?

回答

2

都試一下,YYYY/MM格式轉換它們,然後進入日期以確保攀比是平等的,就像這樣:

Date(ToText({location_total_kpi_view.time_period}, "yyyy/MM")) >= 
Date(ToText({?startMonth}, "yyyy/MM")) and 
Date(ToText({location_total_kpi_view.time_period}, "yyyy/MM")) <= 
Date(ToText({?endMonth}, "yyyy/MM")) and 
相關問題