How to store the history

0
Hello all,  I have a 2 entities offer and history both has the one to many association. I want to create the logic where when offer amount is change the history of this will capture. For example offer1 amount is 1000 if we changed it 2000 then 3000 and so on so all the history of the amount should get saved. How can I do this.  Thanks
asked
2 answers
0

One way to do this is to save each old offer.

 

Imagine you have an entity Request where someone can make an Offer. We're going to make two associations between Request and Offer: something like a 1-1 association for "CurrentOffer_Request" and a 1_* association "OldOffer_Request". 

 

Now, when someone makes the first offer, create an Offer object and associate it with Request in the CurrentOffer_Request association. If a new offer is made, set the "CurrentOffer_Request" association for the new offer, and on the old offer, set that association to empty and instead set the "OldOffer_Request" association. That way you always have all your old offers and the most recent offer available.

answered
0

You may want to look at the AuditTrail module in the Marketplace. It creates a log of all the changes made to certain objects. It sounds like this is what you need, but uses it's own entities rather than the History entity you mentioned.

 

https://docs.mendix.com/appstore/modules/audit-trail/

 

I hope this helps.

answered