Search code examples
lotus-noteslotus-dominolotusscriptlotuslotus-formula

What's wrong with my formula? Just want to show the correct days left


I am trying to determine what is wrong with my formula. Just want to show the correct days left.

Exp. Date = RSPOExpDate

Using Domino Designer 8.

Please see screenshot

temp := ((RSPOExpDate - @Today)/60)/60;
tempdays := @TextToNumber(temp)/24;
days := @Left(@Text(tempdays); ".");
@If(days = @Text(days));

Screenshot


Solution

  • Don't include in your view selection formula or column formulas any function which delivers current time or date like @Now or @Today for performance reasons. Those functions cause the view to refresh every time it is called.

    In case you want to stay with it then change your formula to

    @Integer((RSPOExpDate - @Today)/60/60/24)
    

    In case RSPOExpDate can be empty use this

    @If(RSPOExpDate = ""; ""; @Integer((RSPOExpDate - @Today)/60/60/24))
    

    Update:

    Write an agent that runs sometime in first hours of every day with the formula:

    FIELD DaysLeft := @If(RSPOExpDate = ""; ""; @Integer((RSPOExpDate - @Today)/60/60/24))
    

    Your column formula is then just

    DaysLeft 
    

    or you show a red/green flag icon

    @If((DaysLeft)<=90; 181; 182)