Hi Jochem,
What does your microflow look like? Also, considering the tag 'calculated attribute’ when do you intend to calculate VrijVooraad, is BestelOpdracht committed to the database at this point?
Kind regards,
Jeroen
In the microflow where you have the Artikel-object available, do an Xpath retrieve on BestelOpdrachtRegel, select objects that are associated to a BestelOpdracht with Geleverd = Nee and that have an association to Artikel. Something like this:
[ModuleName.BestelOpdrachtRegel_BestelOpdracht[ModuleName.BestelOpdrachtRegel/Geleverd = 'Nee' and ModuleName.BestelOpdracht_Artikel = $Artikel]]
Do a sum of the Hoeveelheid attribute and you have the value you need to substract from TechnischeVoorraad. Do make sure you put the value of Geleverd and the association from BestelOpdracht to Artikel in their own brackets!
The point in your application where you actually run this microflow is depending on your business case and database interactions.