adding a day to a date

What is the way to add a day to a date?

For example, when I do: datetime(year(today()), month(today()), day(today()) + 1, 13), it doesn't work for the case when today() = last day of the month. For example, yesterday was the last day of the month (the 31st) and we had an issue because 31 + 1 is 32 and that day doesn't exist. What is the way to add a day so that the system figures out by itself that August 31st + 1 is September 1st and not August 32nd?

OriginalPostID-232448

  Discussion posts and replies are publicly visible

Parents Reply Children
  • But my rule is not working . Can you suggest here why its filtering data for upcoming days. I have correct data in DB . For today() its working fine but whenever i try to fetch today()+1 or the way you suggested both are not working.

     

    =a!queryEntity(
    entity: cons!TEST,
    query: a!query(
    logicalExpression: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    if(
    ri!dateFlag = "date",
    a!queryFilter(
    field: "start",
    operator: "=",
    value: todatetime(
    today()
    )
    ),
    a!queryFilter(
    field: "start",
    operator: ">",
    value: todatetime(today()+5*day())
    )
    )
    }
    ),
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    )
    )
    ).data

  • 0
    A Score Level 1
    in reply to sauravk
    it is difficult to say what is wrong without knowing how you have set-up the CDT, how you have saved the data on the DB and which data is present there.

    I would first get the data "start" from the DB without filtering. Then create an expression rule to play with the data and make sure you are handling well the date fields.
  • I have checked this. Its coming out without filtering even coming out with todatestamp(today()) also. I have saved this in DB as timestamp only. Its not working with (>,today()+1,etc) where ever i am trying to fetch data greater then current date.

     

    =a!queryEntity(
    entity: cons!TEST,
    query: a!query(
    logicalExpression: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    if(
    ri!dateFlag = "date",
    a!queryFilter(
    field: "start",
    operator: "=",
    value: todatetime(
    today()
    )
    ),
    a!queryFilter(
    field: "start",
    operator: ">",
    value: todatetime(today()+5*day())
    )
    )
    }
    ),
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    )
    )
    ).data

  • 0
    A Score Level 1
    in reply to sauravk
    remove the filtering, save the expression rule and call it from a different expression rule.
    Test the rule and check the output as an expression. There you should be able to see which function is Appian calling to convert your data (ie fv!datetime).

    Once you see the function that is using, try to use the same one in your operator.
  • Its working fine now. I have refreshed Data management. There were some sync issue with tables.