Set Up a Snapshot

Generally, in a master-detail relationship, the lookup field in a detail record effectively imports the current value of a field in the master record. If the value of the field in the master record changes, then the value in the lookup field changes as well. There are times; however, when it would be useful to freeze the value in a lookup field. Quick Base does this using snapshots.

For example, in an Order Entry application with a Products table and an Order Details table, there might be a lookup field in the Order Details table that looks up the price of an item in the Products table. When someone places an order, they order the product at its current price and that's what they expect to pay. The price should never change in the Order Details table if the price changes at a later date in the Products table.

You can capture the value in a specific lookup field used in a master-detail relationship and freeze it by setting the Snapshots field property for the field that will hold the frozen values. Once you have captured the value of a specific lookup field, the value in this field (in the details table) will not change when changes are made to the contents of the master record. The only time the value of a field set to be a snapshot can change is if the detail record is changed so that it refers to another master record. Then the snapshot field would take on the value of the lookup field in the new master record, and afterwards it will be frozen as described above.

When you initially set up a snapshot field for an existing application, you may want to update all the existing records with a snapshot of the current value. You can do this by selecting the Snapshot checkbox in the Advanced section of the field properties. If you select this option and the field you designate as a snapshot field contains existing values, those values will be overwritten with the current value in the master record.

When setting up snapshot fields, the following rules apply:

To set up a snapshot field:
  1. Open the application for which you want to set up a snapshot field. (This is only useful in apps with multiple tables.)

  2. If a relationship doesn't already exist, create a relationship between the table that contains the field that you want to look up (the Products table in the example above) and the table in which you want to display it (the Order Details table in the example above).

  3. Add a new field in the details table (the Order Details table in the example above) to hold the snapshot value of the lookup field (using the example above, create a field named "Order Price" to hold the snapshot value of a lookup field named "Price").

  4. Click the field name to open the Field Properties page for the field that you just created, and scroll to the Advanced section of the page.

  5. Select the Snapshot checkbox, labeled Get this field's value from a lookup field and don't allow the value to change.

  6. From the Lookup field dropdown, select the lookup field whose value you want to capture.

  7. To update all the existing records in your application with a snapshot of the current value (or the current price, in this case), select Initialize field for existing records, click Save, and then click OK to confirm that you want to overwrite the existing values in this field with the current values in the master record.

    Note: This option is only available at the time you set up the snapshot field.

 

Go back      |       |   

© 1999-2018  QuickBase, Inc.  All rights reserved.  Legal Notices.