Variable with expression

Stimulsoft Ultimate discussion
Post Reply
Steff23
Posts: 16
Joined: Tue Apr 23, 2024 6:55 am

Variable with expression

Post 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?
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: Variable with expression

Post 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.
Steff23
Posts: 16
Joined: Tue Apr 23, 2024 6:55 am

Re: Variable with expression

Post by Steff23 »

The second suggestion worked, thank you!
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: Variable with expression

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply