Our fiscal year begins on July 1 and ends on June 30. We had created a filter to select, but also people wanted to select and compare fiscal years in their datapages. So, we wanted to create a Fiscal_Year field that we could refer to, for example if a 'Finish_Date" field was between July 1, 2019 and June 30, 2020 inclusive, set the Fiscal_Year to "1920", as it is integer. We had some typing issues, but Caspio helped us with the following for Fiscal year 1920 and 2021. If you have any other suggestions, please let me know.
CASE
/* Fiscal Year 19/20 below */
WHEN CONVERT(DATETIME, [@field:Finish_Date], 101) BETWEEN CONVERT(DATETIME, '07/01/2019', 101) AND CONVERT(DATETIME, '06/30/2020', 101)
THEN
CONVERT(VARCHAR(10), (1920), 101)
/* Fiscal Year 20/21 below */
WHEN CONVERT(DATETIME, [@field:Finish_Date], 101) BETWEEN CONVERT(DATETIME, '07/01/2020', 101) AND CONVERT(DATETIME, '06/30/2021', 101)
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Brayton
Our fiscal year begins on July 1 and ends on June 30. We had created a filter to select, but also people wanted to select and compare fiscal years in their datapages. So, we wanted to create a Fiscal_Year field that we could refer to, for example if a 'Finish_Date" field was between July 1, 2019 and June 30, 2020 inclusive, set the Fiscal_Year to "1920", as it is integer. We had some typing issues, but Caspio helped us with the following for Fiscal year 1920 and 2021. If you have any other suggestions, please let me know.
CASE
/* Fiscal Year 19/20 below */
WHEN CONVERT(DATETIME, [@field:Finish_Date], 101) BETWEEN CONVERT(DATETIME, '07/01/2019', 101) AND CONVERT(DATETIME, '06/30/2020', 101)
THEN
CONVERT(VARCHAR(10), (1920), 101)
/* Fiscal Year 20/21 below */
WHEN CONVERT(DATETIME, [@field:Finish_Date], 101) BETWEEN CONVERT(DATETIME, '07/01/2020', 101) AND CONVERT(DATETIME, '06/30/2021', 101)
THEN
CONVERT(VARCHAR(10), (2021), 101)
ELSE
''
END
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.