Queries to get deleted elements [message #1839449] |
Sun, 21 March 2021 20:35  |
Eclipse User |
|
|
|
Is there a way to get deleted elements in a specific version via queries. For example, to get newly added elements, I use the queries Model.allInstances().select(i| i.previous.isUndefined());
For deleted elements, I need to go back to the previous version and check for elemens where x.next is undefined or null. How can I construct a query like this.
Thanks
|
|
|
Re: Queries to get deleted elements [message #1839469 is a reply to message #1839449] |
Mon, 22 March 2021 09:21  |
Eclipse User |
|
|
|
Hi Saheed,
Do you need this across all types in the model, or only for one specific type? If it's for one specific type, you can take advantage of the fact that types have their own history - they have a version for each timepoint in which the set of instances changes. For instance, if I want to know all the Gizmos that were deleted in the previous version, I should be able to do this:
Gizmo.latest.prev.all.select(g|g.next.isUndefined())
If you need it for a previous version and across all types, you could do something like:
Model.allInstancesAt(timepoint).select(i | i.next.isUndefined())
You will need to calculate that timepoint in some way, which will depend on your needs.
Hope it helps,
Antonio
|
|
|
Powered by
FUDForum. Page generated in 0.03323 seconds