Error in calculated decimal attribute with microflow

Hi, I''m running in to a problem when I want to calculate an attribute from two other attributes. In my domain model I've got an entity called 'Vrij' with two attributes, 'Van' and ' Tot'. These attributes represent a start and end date and are both of type 'Date and Time'. What I want to do is split one  object of 'Vrij' in n objects where n is the amount of days between  'Van' and 'Tot'. I wanted to do this in a new entity called 'UrenTotaalDag', this entity should have one attribute with a date and one decimal attribute with an amount of hours that specific date. The amount of hours should be between 0 and 8 per date, depending on the amount of hours between 09:00 and 17:00. I'm not sure how to do this calculation, but i thought I could start with calculating the total amount of hours between the 'Van' and 'Tot' attributes of entity 'Vrij' by making the attribute 'UrenTotaal' from entity 'UrenTotaalDag' calculated by a microflow, which has the expression: hoursBetween(($Vrij/Van),($Vrij/Tot)) I'm now getting an error I do not really understand. Microflow should have on parameter of type of type MMO6.UrenTotaalDag. Could you help me with what I could do to resolve this error, or how else I could achieve my goal? Extra info: - Eventually, the relation between 'Vrij' and 'UrenTotaalDag' should be 1to*, but since the total amount of hours is not linked to a date, it now is a 1to1 temporary. - I want to split the objects, because I want to show these objects in a calenderview, so that each date has a value of 0 to 8. Images:
1 answers

Hi Abel,

The first problem that I can see is that the Calculated Attribute AantaUur's Microflow has input param of Vrij entity which should not be the case. Your MF should have only one input param of UrenTotaalDag. Inside the MF you should retrieve the Vrij type object through its association with UrenTotaalDag. Then it will work fine provided there is a Vrij type object associated to UrenTotaalDag.


PS: Do add a check for the retrieved Vrij type object to be empty or not before proceeding. I could have added a mockup MF with the changes but I don't have access to share screen shots from my office workstation so you would have to do all the heavy lifting :P 


Good Luck and let me know if you have any questions.