Month calculation

1
Hi, I want to calculate months, I have 2 dropdowns 1 for number of months and other is for start month jan to dec so now if I select start month May and  number of months 4  so here it should calculate 4 months from may, (till sept) and then I want to display 5th month that is October, I am using nanoflow so here I want to calculate months and want to display 5th month
asked
2 answers
0

You can make a nanoflow that looks something like this:

 

  1. Get the number of the selected month (you can put them in the database if needed)
  2. Add the number of months from the input field
  3. Check if the number is over 12. If so, deduct 12.
  4. Convert your month number back to a month name.

If you don't have the month numbers in the database, you can fiddle around with parseDateTime() and formatDateTime() functions to get the correct month instead, but since it's only 12 values it might be easier to just add them manually.

answered
0

Hi Kalyani,

 

I am just giving sample logic in microflow to calculate month. Logic will be same like Eline told.

 

Create new entity for Month which stores month number and month name.

 

In microflow, Retrieving selected Month and Number of months to be added.  

 

From the selected month object, i will retrieve selected month number. Then I will add the selected month number + number of months to be added + 1 to get the month as per your requirement. Once number is retrieved, i will retrieve month object using number. Then I will update that month in calculated month attribute.

 

As Eline told, Once your addition is done, If your result is > 12, then subtract it from 12 to get required month.

 

answered