Check if attribute has new value

3
Is it somehow possible to check whether an attribute has a new value - I am thinking about something quick along the lines of a function similar to isNew() - I do not want to store the attribute twice as new and old. I want to create a breadcrumb style history for an object showing different stages it has been through. At present I have one string and am checking whether the string contains the stage if not add to the string else dont. But in the case a stage appears twice - I have no way of displaying it.
asked
3 answers
5

If you haven't committed the new state yet, you can use Retrieve From Database to get the same object and compare those two. The database will be the old version and the object you didn't commit yet should contain all the changed values.

answered
4

If performance is an issue, you can solve this in Java Actions without needing to retrieve the object from the database again. This can be done by checking the previous value of the member of an object. This would be done by calling IMendixObject.getMembers(), then looping through these members and calling getOriginalValue() and comparing this with the current value.

You can also call IMendixObject.getChangedMembers() to see changed members.

answered
2

Realize this is a pretty old thread, but Community Commons has a couple pretty awesome Java Actions that help solve this. Take a look at "memberHasChanged" and "getOriginalValueAsString". Both very useful and easy to configure.

answered