AX1760

Running an Axiom query before a save-to-database

In some cases, you may need a particular Axiom query to run immediately before a save-to-database block is processed. The primary use case for this option is as follows:

  • The file contains multiple save-to-database blocks—meaning, multiple [Save2DB] tags.
  • The data to be saved in one of the save-to-database blocks is generated by running an Axiom query.
  • The data returned by the Axiom query is affected by one of the previous save-to-database blocks in the file.

For example, imagine that you have SaveA on Sheet1, and SaveB on Sheet2. The data for SaveB is populated by an Axiom query, and that Axiom query includes data from the target table for SaveA. Under normal circumstances, SaveB would not reflect the most current data from SaveA, because the Axiom query would not be run in-between the two save-to-database blocks. Even if the Axiom query was configured to Refresh After Save Data, that refresh behavior means that the query is refreshed after all save processes are complete.

Instead, you can configure SaveB so that it triggers the Axiom query to run before SaveB is processed. This configuration is made in the Save2DB tag that controls SaveB. When the save-to-database is executed for the file, SaveA is processed first, then the Axiom query is run, then SaveB is processed.

Configuring a save-to-database to trigger an Axiom query

If you want an Axiom query to run before a particular save-to-database block is processed, enter the name of the Axiom query into the seventh parameter of the Save2DB tag. The Axiom query must be located on the same sheet as the Save2DB tag.

The easiest way to create the tag is to use the Save2DB tag helper dialog. To open the helper, right-click the cell and then select Axiom Wizards > Insert Save2DB tag. Once the tag has been placed in a cell, you can double-click the cell to open the editor again. Keep in mind that if the tag is constructed using a formula, then editing the tag using the helper will overwrite the formula.

Example Save2DB helper dialog with an Axiom query specified

The configuration in this example creates a Save2DB tag that looks like the following:

[SAVE2DB;MyTable;;;;;True;SaveAQ]

Immediately before this Save2DB block is processed, the designated Axiom query will be run.

Requirements and limitations

  • The Axiom query must be located on the same sheet as the Save2DB tag, and the query must be active. No particular refresh behavior settings are required.

  • The query can add rows with [Save] tags and those rows will be processed as part of the save-to-database. However, the query cannot create new Save2DB tags.

  • If the Axiom query errors, then the save-to-database process fails and no further saves will be processed.