Adding a number to a date

0
Hello, I have a question: In my system I have a order delivery date. The order delivery date is calculated. the calculation is the date of order + the delivery days. the delivery days depends on the supllier. I want to know how I automatically can calculate the order delivery date with the input from the dat of order and the delvery days. I need to do this in a microflow. 
asked
3 answers
0

Hi Nasr,

Assuming you have an entity called Delivery with 3 attributes:

- OrderDate

- Delivery Days

- DeliveryOrderDate

You can use the addDays function (https://docs.mendix.com/refguide/add-date-function-calls#6-adddays-utc) in your change object action in a microflow for attribute DeliveryOrderDate.


In case you cannot see the image below, the attribute DeliveryOrderDate is set to: addDays($OrderDate, $DeliveryDays) 

answered
0

Hello, thanks for your reaction. I already found this function but I don't know how to use it and where to use in a microflow. Doy you maybe have an example to clarify?

answered
0

Be wary of using calculated attributes, they can cause performance issues and the calculation is done every time the object is used regardless of whether the attribute is used or not. 

You can set this date with a microflow whenever it makes the most sense for your process. This can be calculated on a recurring basis via a scheduled event, or you can set this as soon as the order date is set or as soon as a supplier is associated via on-change action or through a microflow tied to a a user action like a “save/continue” button as an example. Lastly this could possibly be calculated via a data view with a source of microflow if you must calculate this and display to user once they view the page and you cannot calculate it before hand as mentioned in the previous option.

In all microflows you can change the date within the Change object action for the object that contains the attribute you wish to set.

answered