Skip to main content
Known Participant
January 20, 2021
Question

todate() function returning wrong result in expression rule

  • January 20, 2021
  • 7 replies
  • 0 views

Hi All,

We have just upgraded to Appian 20.4. I am not sure if the issue due to this but facing very strange scenario when using todate() function in an expression.

todate("08/01/2021")<=todate(null)  --> this expression ideally should return false, but instead returning true. It was working as expected earlier.
Please advise.
Thanks and Regards,
Diksha

    7 replies

    csteward
    Brainy
    January 20, 2021

    I do not have a 20.4 environment handy, but can confirm this expression returns false in both 19.4 and 20.3.

    mikes0011
    Brainy
    January 20, 2021

    On what grounds would you expect this comparison (comparing a date value, which at the end of the day evaluates to an integer, versus NULL), to evaluate as FALSE?

    The Expression Guru
    Participating Frequently
    January 20, 2021

    Hi All,

    despite the fact what we would expect as a result out of this expression. I can confirm the behavior: in version 19.4 it renders to 'false' in version 20.4 the expression renders to 'true'.

    I guess we have to evaluate our application code for the cases were a null would be passed into the 'todate' function and check if some decisions or branching is based on that. 

    Would be nice if the Appian Product Team could shed some light on it about their thought process. 

    mikes0011
    Brainy
    January 20, 2021

    I'm in 20.4 and I can confirm that tointeger(todate("08/01/2021")) returns a value of "-4901".  (I'm curious what it results in 20.3 or earlier.)

    So if the comparison operator assumes "null" has an inherent integer value of zero, then the current result is as expected.  However in the past I've found that using any such value comparison against NULL values is unpredictable and not recommended.

    The Expression Guru
    Participating Frequently
    January 20, 2021

    In 19.4 tointeger.. returns the same: '-4901'. And I agree, it is not best practice to compare against null. But we run in some cases where a connected system changed its behavior because the C# framework was updated. It returned null in date fields instead of blanks. You know the rest of the story.

    peter.lewis
    Participating Frequently
    January 20, 2021

    I'd suggest opening a ticket with Appian Support.