Retain snapshots of data during sync
When you are adding a file or SQL item to Sync, the Retain Snapshot option is available. This option is typically used to convert a values as at now type query into over-time analysis.
A popular use case is Stock on Hand, where a snapshot is taken each day. Without enabling this option, the Phocas database would just show the stock from yesterday. By retaining monthly snapshots, you could see what the stock was yesterday, and in any previous months, allowing variance reporting and trend analysis. This historical data is usually not available in an ERP system.
Snapshots are taken for every moment, even when there is no change to source data.
Impact of snapshots on build times
Use caution when retaining snapshots, as they can result in very large volumes of data being stored, which can cause databases to take too long to build. This is especially true for daily snapshots. Snapshots should NOT be used for large data sources, such as sales invoices.
Enable snapshots
Select Retain Snapshots > Enable Snapshots checkbox.
Select whether you want snapshots retained daily, monthly or a custom interval, such as quarterly. For example, if you select Daily, you can sync as many times as you like and Phocas keeps a copy of the data as at the last sync of each day. Similarly, if you select monthly, a copy of the data as at the end of the month is kept.
Enter the number of days you want to retain the snapshots.
Click Save.
View snapshots
Snapshots are kept over time in the relevant Sync item table, with a SyncMoment column automatically added. To view the items in Phocas, go to Administration > Sync Sources and select the relevant source to view the data items in more detail.
You will see not only the latest synced data but also data from retained snapshots. For example, in the image below, the most recent sync was on 2018-01-17. You can see this data, and data from the previous sync a day earlier, on 2018-01-16.