我需要的是一個數據項表達式,它輸出去年當前季度的開始日期。找到當年很容易,因爲從那一天起減去1年。但除此之外,我卡住了。Cognos 8中的日期算術
我現在有一個像醜if
表達每個季度:
if (extract(month,current_date) in (10,12,12)) then ((extract(year,_add_years (current_date,-1))||'-10-01'))
但無論我做什麼,我不能concatonate年份和日期轉換爲字符串,我可以轉換成日期對象。上面的代碼提供了錯誤:
The operation "add" is invalid for the following combination of data types: "integer" and "character"
嘗試投放的整數使用cast()
我得到這個錯誤的字符。我也得到試圖把字符數組轉換成日期時,此錯誤:
The operation "condexp" is invalid for the following combination of data types: "character" and "integer"
嘗試使用SQL Server特定功能(它是一個SQL Server數據庫)只是給了我一個錯誤,這些功能是當地不可用處理,所以我似乎無法使用SS日期算術,並且我找不到特別適用於Cognos內置日期函數的任何內容。
如何操作日期以將一年添加到已知的日/月組合並將其用作日期對象?