I want to filter out current month dates in a list
"9/9/2022",
"9/8/2021",
"10/7/2022",
"9/29/2021",
"10/24/2022",
"7/19/2022",
"5/16/2022",
"8/15/2022",
"9/14/2022",
"10/14/2021",
"1/13/2022"
Expected result: {"10/7/2022","10/24/2022"}
Can somebody help me with this ?
Discussion posts and replies are publicly visible
a!localVariables( local!dates: { "9/9/2022", "9/8/2021", "10/7/2022", "9/29/2021", "10/24/2022", "7/19/2022", "5/16/2022", "8/15/2022", "9/14/2022", "10/14/2021", "1/13/2022" }, local!month: month(today()), local!year: year(now()), a!forEach( items: local!dates, expression: if( like(fv!item, concat(local!month, "/*/", local!year)), fv!item, {} ) ) )
Thanks a lot
We do not need to try to beat every problem with a foreach.
a!localVariables( local!dates: { "9/9/2022", "9/8/2021", "10/7/2022", "9/29/2021", "10/24/2022", "7/19/2022", "5/16/2022", "8/15/2022", "9/14/2022", "10/14/2021", "1/13/2022" }, index( local!dates, where(month(local!dates) = month(today())) ) )
This code actually also includes dates from 2021. You might also have to add the year filter.
True :-) The following code should cover this.
a!localVariables( local!dates: { "9/9/2022", "9/8/2021", "10/7/2022", "9/29/2021", "10/24/2022", "7/19/2022", "5/16/2022", "8/15/2022", "9/14/2022", "10/14/2021", "1/13/2022" }, index( local!dates, where( text(local!dates, "mmyyyy") = {text(today(), "mmyyyy")} ) ) )
You can also try this:
a!localVariables( local!dates: { "9/9/2022", "9/8/2021", "10/7/2022", "9/29/2021", "10/24/2022", "7/19/2022", "5/16/2022", "8/15/2022", "9/14/2022", "10/14/2021", "1/13/2022" }, a!forEach( items: local!dates, expression: if( and( month(fv!item) = month(today()), year(fv!item) = year(today()) ), fv!item, {} ) ) )