Variable with expression
Posted: Tue Nov 12, 2024 2:35 pm
I have a data band with a text field, and in the text field, there is the following expression:
This expression works and shows me how many days are left until the next birthday. I would like to write this expression into a variable and then display it in a chart. However, I keep getting an error. The variable I created is named “nextBirthday” and is of type int.
I would like to display how many days are left until the next birthday in a bar chart or with sparklines. I assumed that you could load the corresponding value from a variable. I do not have this value in a database; it has to be calculated – see the expression. Is there another way to achieve this?
Code: Select all
{IIF(DayOfYear(DateSerial(Year(Today), Month(EMPLOYEES.DATEOFBIRTH), Day(EMPLOYEES.DATEOFBIRTH))) >= DayOfYear(Today),
DayOfYear(DateSerial(Year(Today), Month(EMPLOYEES.DATEOFBIRTH), Day(EMPLOYEES.DATEOFBIRTH))) - DayOfYear(Today),
DaysInYear(Today) - DayOfYear(Today) + DayOfYear(DateSerial(Year(Today) + 1, Month(EMPLOYEES.DATEOFBIRTH), Day(EMPLOYEES.DATEOFBIRTH))))}
I would like to display how many days are left until the next birthday in a bar chart or with sparklines. I assumed that you could load the corresponding value from a variable. I do not have this value in a database; it has to be calculated – see the expression. Is there another way to achieve this?