How to create a Snapshot App
This post will explain how to create a snapshot app. This is really useful for when you have financial figures that change but you need to capture the month-end statistics. - Click here to see the video on how to do this.
Creating and integrating the snapshot app
For a snapshot app, you will need a parent app (which is where the data will be stored and modified) and an integrated child app (which is where the snapshots will be created and stored.
For information on how to link a child application, read the support article here.
Setting up the fields in the snapshot app
To pull information from the parent into the snapshot app, you will need to use parent expressions. For information on this, read the support article here.
A good idea is to have important information from the parent app (e.g. title, owner etc….) as a reference. In my example, I have put this into their own template at the top like so:
Create a date field called RecordCreated and put a CreatedDate() expression into this:
And a bit field called Master and click to exclude from templated reports:
Set up the fields that you want to pull down into the snapshot app (e.g. financial grid, note details, etc…). The way to do this is to set the parent expression as a default initial value and click “Process default initial value as an expression”. This will mean that the data is pulled from the parent app at the time of the copy and link workflow (the 1st of the month) and will not be updated with any new data - the default value will be pulled when the record is created, whereas if you used a normal expression, it would update with every change in the parent record.
In this example, I used a financial grid. To do this, I needed to set up one number field for each cell of the grid and then created a grid to pull the information from these fields, because you cannot set up default initial values in a grid field.
After this has been set up, you can set up the expressions and workflow in the parent. You will need to make sure that there is a text field which captures the month for the data - e.g. on the 1st of February 2023, when it is copy and linked, the field will say 2023-01 as it captures the data from the last month. This is done by an expression here -
if(month([RecordCreated]) = 1, if(isValidDate([RecordCreated]), string((Year([RecordCreated])-1)) + '-' + 12, ''), if(isValidDate([RecordCreated]), string(Year([RecordCreated])) + '-' + if((month([RecordCreated])-1) < 10, '0', '') + string((Month([RecordCreated])-1)), ''))
Let me break down this expression:
if(month([DateNow]) = 1, if(isValidDate([DateNow]), string((Year([DateNow])-1)) + '-' + 12, ''),
This means that if the month is the 1st (January), then take one away from the year that it is now (so last year - if it is 2023, then it will show as 2022), and then put in 12 so this means that it will show as December last year. As this is the first snapshot of the year in January, this means that the data will show as December the year before.
if(isValidDate([DateNow]), string(Year([DateNow])) + '-' + if((month([DateNow])-1) < 10, '0', '') + string((Month([DateNow])-1)), ''))
The rest of the expression deals with every other month (except January), it will take the year it is now and then put a dash with the month minus one, so the previous month. This can then be pasted into the text field for the month captured for the default initial value.
Setting up the copy and link workflow in the parent app
Set up a scheduled workflow to run on the 1st day of every month to copy and link the records. Make sure to click template copy.
This will mean that at the first of every month, preferably early in the morning so it does not interrupt the data input of the users, the snapshot will be created in the child app.
You will need to set up a master record in the child app. This needn’t have any data in, except for the master which will need to be ticked. Therefore, this is seen as the record that all snapshot records are copied from.
Now that this is set up, on the 1st of every month, a new snapshot record will be created, capturing the values from the last month’s data.
Please sign in to leave a comment.
Comments
0 comments