I have 20 records in a transaction. Each of those records has a status.
Possible status are created, opened, closed, accepted, rejected and they can occur multiple times in one transaction. An example would be
created
opened
closed
opened
closed
accepted
Now, I want to find out two durations. From created till the last occurence of closed, and from created to accepted. The last one is easy, I just don't provide startswith/endswith parameters.
But getting the duration until the last occurence of closed is tricky. Because endswith would take the first occurence of closed to end the transaction. And I can't count either, because well I don't know how many records there are after the last closed. Now it's one, but it might as well could be three.
How would I go about doing this?
... View more