Page 1 of 1

Variable with expression

Posted: Tue Nov 12, 2024 2:35 pm
by Steff23
I have a data band with a text field, and in the text field, there is the following expression:

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))))}
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?

Re: Variable with expression

Posted: Wed Nov 13, 2024 8:13 pm
by Lech Kulikowski
Hello,

Try to set the ReadOnly option for the variable. Or try to use a calculated column instead of the variable.

Thank you.

Re: Variable with expression

Posted: Mon Nov 18, 2024 1:39 pm
by Steff23
The second suggestion worked, thank you!

Re: Variable with expression

Posted: Mon Nov 18, 2024 1:58 pm
by Lech Kulikowski
Hello,

You are welcome.