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 Reply Children
  • Try this

    load(
    local!findMonth: 3,
    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/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",

    },
    local!dateIndex: where(
    a!forEach(
    items: local!dates,
    expression: mid(
    fv!item,
    4,
    2
    ) = text(
    local!findMonth,
    "00"
    )
    )
    ) + 1,

    index(
    local!dates,
    if(local!index = 13, 1, local!index)
    )
    )