Question

For a custom report, all services (or products, expenses, fixed fees) should be listed for a given revision. When filtering the relevant tables on revisionID, the result is incomplete and items are missing.


Reason

Changepoint adds a new line into BudgetServices (and the other tables) for a new revision only if there has been a change in the data. Otherwise, the line from the previous revision remains valid.

Resolution

Use the table RevisionItems to join from a given revisionID to the various elements of a budget. This will always include all elements that are effectively included in a revision, even if they have been originally created in a previous revision.

Also filter on deleted=0 to exclude items that have been deleted.