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 items24/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
Hi Pauls0003, The following code should serve your purpose.
convert your array using touniformString() function and then this code will work for your case. 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/08/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: 10, index( local!dates, index( where( a!forEach( local!dates, toboolean( find( local!findValue, fv!item, 2 ) ) ) ), 1, - 1 ) + 1, null ) ) Please let me know if this helps.
Hi,
hope the below code help,
=load( local!dates : {List to DateTime}, local!findValue: 12, index( local!dates, wherecontains( if( local!findValue = 12, 1, local!findValue + 1 ), month(local!dates) ), null ) )
Thanks