Print months from an entered start month to an entered end month

Hello everyone, I am making an automation where the user is asked to enter a starting month and an ending month according to a list of options, after that what I need is to print the months that are in the entered range on the screen. For example, if you enter January as the starting month and May as the ending month, I need it to print January, February, March, April, and May…

Does anyone have an idea on how to do it?
Main.xaml (19.6 KB)
meses ingresados.xaml (8.0 KB)

I attach the example file that I am making but it does not work as I think…


you can use for each activity and write into List of items something like this
Enumerable.Range(Cint(Datetime.ParseExact(startMonth ,“MMMM”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM”)),Cint(Datetime.ParseExact(endMonth ,“MMMM”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM”)))
then in loop use if which checks your currentItem has length smaller than 2


Hello zaaq, can you please send the sample file… I can’t see what is written in the log messages

Sure, here you go. :slight_smile:
meses ingresados.xaml (11.1 KB)

1 Like

Did it work for you?

Friend, excuse me, can you please send me the entire project of this example that you are dealing with, I tried to see the file that you attached but I get these errors and from here to when I fixed them it takes a long time…

Thanks and stay tuned.


I gave you entire project. I just use this workflow. I will send you screenshots of workflow then:

for each activity

list of items:
Enumerable.Range(Cint(Datetime.ParseExact(startMonth ,“MMMM”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM”)),Cint(Datetime.ParseExact(endMonth ,“MMMM”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM”)))
Log message in then
Datetime.ParseExact(“0”+currentItem.ToString ,“MM”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MMMM”)
Log message in else
Datetime.ParseExact(currentItem.ToString ,“MM”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MMMM”)

It works as an idea, however it is not what I need because the initial and final months are entered manually by the user and there are months from the indicated initial to the indicated end.

Thank you so much…

Just assign your months to vars: startMonth and endMonth and it will print month range. It may have problem when for example:
Start month is November and end month is January.