take two numbers of year in appgini project with calculated field
Posted: 2020-10-20 07:47
Hello everybody.
As always I hope for the help of those who are more experienced than me and I thank you!
I have three fields:
start_date (date format)
end_date (date format)
updated_end_date (date format)
I would like to create a calculated field with the name "start_end_year" possibly directly in appgini project (and not in the hooks file but if it doesn't make sense to put it in appgini project it's also okay to put it in the hooks file) with a conditional query that:
1 always take the last two numbers of the year from the start_date field
2 add a dash
3 if updated_end_date is empty take the last two numbers of the year of end_date but if instead updated_end_date is not empty take the last two numbers of the year of updated_end_date
Example 1:
start_date = 2020/01/01
end_date = 2021/05/25
updated_end_date = empty
Result: start_end_year = 20-21
Example 2:
start_date = 2020/01/01
end_date = 2021/05/25
updated_end_date = 2022/05/25
Result: start_end_year = 20-22
Thank you very much if you can help me with the code!
Fabiano
As always I hope for the help of those who are more experienced than me and I thank you!
I have three fields:
start_date (date format)
end_date (date format)
updated_end_date (date format)
I would like to create a calculated field with the name "start_end_year" possibly directly in appgini project (and not in the hooks file but if it doesn't make sense to put it in appgini project it's also okay to put it in the hooks file) with a conditional query that:
1 always take the last two numbers of the year from the start_date field
2 add a dash
3 if updated_end_date is empty take the last two numbers of the year of end_date but if instead updated_end_date is not empty take the last two numbers of the year of updated_end_date
Example 1:
start_date = 2020/01/01
end_date = 2021/05/25
updated_end_date = empty
Result: start_end_year = 20-21
Example 2:
start_date = 2020/01/01
end_date = 2021/05/25
updated_end_date = 2022/05/25
Result: start_end_year = 20-22
Thank you very much if you can help me with the code!
Fabiano