STOR and GET functions

Top  Previous  Next

The STOR functions let you store numbers in nine memory locations numbered 1..9. For instance, the formula =STOR4(F5) would store the value from cell F5 in memory location 4. The GET functions retrieve the numbers stored in those in nine memory locations. For instance, the formula =GET4() would return the value stored in memory location 4.

These functions greatly enhance the flexibility and usefulness of FormCalc SST macros, but to use them properly you must be mindful of their limitations.

Why Use STOR and GET?

Using STOR and GET in formulas can sometimes be an easier way to reference data in your formulas, compared to storing the data in a Scratchpad column.

Using STOR and GET is currently the only way to pass data between macros.

For instance, suppose you have one macro with the formula =STOR4(F5), to store the value from cell F5 in memory location 4, and you have a second macro with the formula =GET4( ) in it somewhere. If you run the first macro, then run the second macro, the second macro will return the memory location 4 value stored by the first macro.
If you have computer programming experience you may recognize that FormCalc SST's STOR and GET memory locations are global, meaning they are accessible to all macros.

Considerations for Using STOR and GET

The main thing you must be mindful of when using STOR and GET functions, is assuring that a formula containing a STOR gets called before any formula which contains a corresponding GET.

This is not a problem when the STOR and GET are in two different macros:  you just need to run the macro containing the STOR first, before the one containing the GET.

Where it can be a problem is when STOR and GET are used in the same macro. The most common problem with using STOR and GET functions in the same macro worksheet is failing to insure that the formula containing the STOR is called before any formulas containing a corresponding GET for the same memory location.

Contrast this with what you know about spreadsheet formulas. When a spreadsheet formula references other cells in a worksheet and those cells also contain formulas, there is an internal mechanism which insures that those other cells are recalculated before their formula results are used in the first formula.
 
With FormCalc SST's memory locations no such mechanism is available for determining how formulas containing GETs are dependent on formulas containing STORs.

How can you insure that formulas are called in the right order? The proper approach will depend on the calculation situation you face:

If the GET is used on the Formulas row of the worksheet (i.e., the GET is applied to every row of the target form, such as an invoice), then you might make sure that an IItem-triggered formula containing the STOR gets called on the first row of the invoice—before other rows where the GET might be called. This is a technique used in accessing header fields in QuickBooks Online or QuickBooks desktop editions, for instance.

If the GET is used on a Item-triggered formula row, then you need to assure that either a Formulas row formula or another text-triggered formula containing the corresponding STOR gets called before the formula containing the GET.

For instance, suppose you have a text-triggered formula row which calculates a gratuity on the last line of invoices for your catering business. If a formula on that row contains a GET to retrieve the invoice subtotal on which the gratuity is calculated, then you just need to be sure that the text-triggered row which subtotaled the invoice and STORed that amount appears above the gratuity row on the invoice.