parsing a date array

I have an array that contains a number of dates. I want to provide a month i.e 11 and have Appian return the date for the next month.

i.e

List of Timestamp: 12 items
24/04/2018 12:00 BST 
29/05/2018 12:00 BST
26/06/2018 12:00 BST
24/07/2018 12:00 BST
21/08/2018 12:00 BST
18/09/2018 12:00 BST
16/10/2018 12:00 BST
13/11/2018 12:00 GMT
11/12/2018 12:00 GMT
29/01/2019 12:00 GMT
26/02/2019 12:00 GMT
26/03/2019 12:00 GMT

 

Provide '10' and have as a return 

13/11/2018 12:00 GMT

 

I've tried using wherecontains to get the index but it only matches if i provide a full string (16/10/2018 12:00 BST ), not a subset. 
Any ideas ?

  Discussion posts and replies are publicly visible

Parents
  • Hi,

    Pass the rule input value in this code as ri variable , try this code e,g ri!ip = 07
    load(
    local!dates: {
    "24/04/2018 12:00 BST",
    "29/05/2018 12:00 BST",
    "26/06/2018 12:00 BST",
    "24/07/2018 12:00 BST",
    "21/04/2018 12:00 BST",
    "10/09/2018 12:00 BST",
    "16/10/2018 12:00 BST",
    "13/11/2018 12:00 GMT",
    "11/12/2018 12:00 GMT",
    "29/01/2019 12:00 GMT",
    "26/02/2019 12:00 GMT",
    "26/03/2019 12:00 GMT"
    },
    local!findValue: ri!ip,

    local!indexodmonth:wherecontains(local!findValue,tointeger(right(left(local!dates,5),2))),
    local!dateofrequiredmonth:index(local!dates,local!indexofmonth),
    local!dateofrequiredmonth
    )

    Hope it will work for you.
    Thanks,
    Neha Dangi
Reply
  • Hi,

    Pass the rule input value in this code as ri variable , try this code e,g ri!ip = 07
    load(
    local!dates: {
    "24/04/2018 12:00 BST",
    "29/05/2018 12:00 BST",
    "26/06/2018 12:00 BST",
    "24/07/2018 12:00 BST",
    "21/04/2018 12:00 BST",
    "10/09/2018 12:00 BST",
    "16/10/2018 12:00 BST",
    "13/11/2018 12:00 GMT",
    "11/12/2018 12:00 GMT",
    "29/01/2019 12:00 GMT",
    "26/02/2019 12:00 GMT",
    "26/03/2019 12:00 GMT"
    },
    local!findValue: ri!ip,

    local!indexodmonth:wherecontains(local!findValue,tointeger(right(left(local!dates,5),2))),
    local!dateofrequiredmonth:index(local!dates,local!indexofmonth),
    local!dateofrequiredmonth
    )

    Hope it will work for you.
    Thanks,
    Neha Dangi
Children
No Data