compare list of dates to findout least date and max date logic

Hi Friends,

Can someone help me to find the least date and max date from a given list of dates.

Thanks

Vani

  Discussion posts and replies are publicly visible

Parents
  • You can also use the sorting capability in a datasubset. Here's an example:

    a!localVariables(
      local!listOfDates: {
        {id: 1, date: now()+1},
        {id: 2, date: now()+11},
        {id: 3, date: now()-2}
      },
      /*local!listOfDates.date*/
      local!sortedDates: fn!todatasubset(
        local!listOfDates,
        a!pagingInfo(
          startIndex: 1,
          batchSize: -1,
          sort: a!sortInfo(
            field: "date",
            ascending: false
          )
        )
      ),
      local!sortedDates.data
    )

    If you run this, and then change the 'ascending' attribute to 'true' and then run it again you'll see the order is reversed.

Reply
  • You can also use the sorting capability in a datasubset. Here's an example:

    a!localVariables(
      local!listOfDates: {
        {id: 1, date: now()+1},
        {id: 2, date: now()+11},
        {id: 3, date: now()-2}
      },
      /*local!listOfDates.date*/
      local!sortedDates: fn!todatasubset(
        local!listOfDates,
        a!pagingInfo(
          startIndex: 1,
          batchSize: -1,
          sort: a!sortInfo(
            field: "date",
            ascending: false
          )
        )
      ),
      local!sortedDates.data
    )

    If you run this, and then change the 'ascending' attribute to 'true' and then run it again you'll see the order is reversed.

Children
No Data