Calculate values of attributes

1
Hello,   I would like to calculate the certain values for attibutes. The problem is that while using a microflow i'm unable to reach the correct values. We have the following domain model: I would like to calculate the following value "VrijeVooraad” as follows: VrijeVooraad = TechnischeVooraad – Bestelopdracht/Geleverd/Nee. How can I achieve this?   Thanks for your help!!
asked
2 answers
0

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

answered
0

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.

answered