Calculated attribute shown in grid

0
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.
asked
2 answers
0
  • 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’

 

answered
0

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 )

answered