Month calculation

Hello everyone, I have a question! I want to create a table as shown above, which consists of a year (a total of 12 months). Whenever I choose a month and the year in the first cell, I want the subsequent cells to calculate the following months. For example, if I start with June 2023, I want the second cell to display July 2023, and the third cell to display August 2023. Could you please help me with this?
2 answers

Hi Selcuk, 


What you can do is to create two attributes (InputDate and AddMonths both DateTime). The $InputDate is needed for the selected date and year within a Date Picker. After selecting the date within the Date Picker, you need to configure a microflow after clicking the 'Save' button or in your case a on change microflow.


The parameter in this microflow needs to be the $InputDate. Then you need to start with create an object $AddMonths and set a reference to $InputDate. After this you can change this object $AddMonths with addMonths($InputeDateAddMonth/AddMonth, 1) that will add exact 1 month according to the selected date from $InputDate used at the Date Picker. 


However this wil display just 1 month. To get this done for more months you can use a Loop with variable for example let's say 5 months (Variable Counter +1) to create more $AddMonths and then finish the microflow. Also you can add seperate attributes like AddMonth1 etc. as needed in your example where you need to fill in directly below the date and show above the +1 Month date. It can be easily done in this way. If you need help let me know. 








the goal of your question isn't clear to me, but i think using the addMonths function in a microflow might be the answer to your question. You can find an explanation about this function in the article below.


Add Date Function Calls | Mendix Documentation


I hope this will help you along.

Happy modeling!


Kind regards,

Martijn Hingstman