Forum Discussion

JesseBerry1's avatar
JesseBerry1
Qrew Trainee
7 years ago

Snapshot based on summary field not working on first record

I have a Stores table and an Orders table. On the stores table, I have a summary field called MaxEnding# that is based on the max value of a numeric field in the Orders table. 

The orders table then has the MaxEnding# as a lookup field from the Stores table and I have a snapshot field that captures the MaxEnding# value.

On the Orders table, I have a numeric formula called Starting# that is [Snapshot_MaxEnding#] + 1.
On the Orders table, I also have a numeric formula called Ending# that adds Starting# to another numeric field that specifies the number of records being processed in the order. This field (Ending#) is what is summarized back to the Stores table.

Basically, I'm trying to auto-calculate the next record number that needs to be processed for each order.

When I add the very first record in the orders table (and tell it I'm adding 10 records for that order) and before I save the record, the Starting# shows "1" correctly. As soon as I hit save, it switches that value to "11". It looks like the snapshot reloads the summary field somehow before and after saving that record.

Any subsequent record in the Orders table works exactly as I want, it's just the first record. I've tried checking [Snapshot_MaxEnding#] for null and that doesn't make any difference. 

This is a simplified version of my issue as I'm actually tracking starting #s for each store, not just systemwide.

Any help is appreciated.
  • If your example persists where it is only happening on the very first order, it might be a behavior related to their not being a value for the first record, so the lookup field for starting number has to reset for the first time. You can probably get it to work if you add a catch in your starting # formula that if you don't have any orders saved yet to force it to remain at 1 rather than adding the additional counter

    Chayce Duncan | Technical Lead
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base