Listview, sort changed date user specific.

0
Hi all,  In Listview you can sort by the changeDate, which will show every user the list of objects in the same order.  What i'd like to do is sort by the date the current user made a change. So each user will see the most recent object they have updated. Many thanks,  Garion
asked
1 answers
1

I think you'll need to create a new entity that represents the last access of your main object. For the purposes of this example, I'll call the new entity OrderChange and your main object Order.

Create OrderChange with no attributes - just check the "changed date" system member option. Then add an association from this entity to your Account entity. Also add an association to Order. These should both be many-to-one associations, with the OrderChange object on the many side.

On your list page, show a list of OrderAccess objects sorted by changedDate. You'll be able to use the association to Order to show any of its attributes in your list. Now, whenever a user accesses an Order you'll need to create or update their OrderAccess object. That will happen by simply committing the OrderAccess object whenever the user commits a change to the Order.

The final challenge is that this only works if there exists an OrderAccess object for each user in your app. Depending on your use case, this may or may not be a problem. If it is, you could consider creating a second list of Orders either below your main list or in a different tab. This list would be a list of Orders, perhaps using XPath to hide any orders that the current user has changed in the past.

Hope that helps!

answered