Skip to main content
Known Participant
November 22, 2023
Solved

I want to generate 24 months based on the given month and year

  • November 22, 2023
  • 2 replies
  • 0 views

I want to generate 24 months based on the given month and year.

for ex: if i gave "Nov-23" as rule input

i want to get next 24 months list, result something like this {Dec-23,jan-24,feb-24,mar-24,apr-24}.

can someone help to achieve this

    Best answer by sriramk5349

    Hi [mention:eb1eb969d9fb4b92b282820e0b70ee27:e9ed411860ed4f2ba0265705b8793d05] ,

    Below code will help you

    a!localVariables(
      local!input:"Nov-23",
      local!dummyDate:todate("01-"&local!input),
      a!forEach(
        items: enumerate(24)+1,
        expression: text(todate(a!addDateTime(local!dummyDate,0,fv!item,0,0,0,0)),"mmm-yy")
      )
    )

    2 replies

    sriramk5349
    November 22, 2023

    Hi [mention:eb1eb969d9fb4b92b282820e0b70ee27:e9ed411860ed4f2ba0265705b8793d05] ,

    Below code will help you

    a!localVariables(
      local!input:"Nov-23",
      local!dummyDate:todate("01-"&local!input),
      a!forEach(
        items: enumerate(24)+1,
        expression: text(todate(a!addDateTime(local!dummyDate,0,fv!item,0,0,0,0)),"mmm-yy")
      )
    )

    Known Participant
    November 22, 2023

    Thank you Sriramkaja it works!!