Update Query Tag on Execution of Transaction Group

I have a transaction group that I need to write to a database when a value changes. At this time, I need to query this database and find a value from the most recent entry and then have part of my new entry use this value. Is it possible to have a query tag that reads a value from database when a transaction group is triggered, does some math with the queried value, and writes the new value as part of the entry made by the transaction group execution?

It looks like you can set up an expression item in a group that runs a query. You might be able to leverage this along with another expression tag to get the computed value you want.

If you can do this calculation on data entry you could also do it on data retrieval and avoid the complexity of what you are trying to do here. I realise that there may be other reasons to do it your way. Explain the problem.