Calculated attribute shown in grid

I’m trying something very simple, but do not manage to figure it out in mendix. Entity: eenheid with attributes id, code, description, number Entity: mutaties with attributes  id, date, number Mutaties has associations to eenheid and to artikel.  In the Page: mutaties tab, that listens to the artikel tab I would like to show the quantity of the ‘mutatie’ which is ‘eenheid.number (of the associated eenheid) * mutaties.number’.    Although quantity it is a derived field, documentation points to create an calculated attribute in the mutaties entity for quantity. (thats strange to me). I tried even with a MF but i’m struggling with it. It looks like the retreive action gets all eenheden. I cannot find how to setup Xpath to just get the one related eenheid thats related to the particular mutatie . I’m new to mendix, familiar with Oracle SQL. Does someone has a simple example that does something equivalent. There is lots of documentation, but the right information is hard to find.
2 answers
  • Go to your entity ‘Mutatie’
  • Add attribute ‘Quantity’. For that attribute:
    • set ‘Value’ to ‘Calculated’ instead of ‘Stored’
    • set ‘Pass entity’ to Yes
    • assign a new microflow named Calc_YourEntity_GetQuantity

Make “Calc_YourEntity_GetQuantity” do the math and return the value in the same type as attribute ‘Quantity’



Thanks Tim, so far I tried and managed. Do you have an example of an MF. The one I created using mutaties as parameter and retrieve object Eenheden of assocation Mutaties_eenheden seems to get all eenheden instead of the eenheid relatied to the mutaties.


With this in the create variable: ( $Eenheden/Aantal * $Mutaties/Aantal )