Panorama’s procedure recorder is like a tape recorder that records your actions as you work. In other words, Panorama automatically writes your code for you! How easy is that? Most commands and tools that affect data can be recorded, including editing, sorting, searching, analyzing, morphing, import/export, and printing.

The recorder works in any Procedure Editor window. When you click on the recorder tool, it turns red to show that the recorder is running.

Once the recorder is running, simply go to a data sheet or form window and perform the actions you want to record. If the procedure window is active, you’ll see each line of code appear as each step is recorded. New steps are always added at the end of the procedure (even if you’ve been editing the code at some other spot).

That’s all there is to it! When you’re done, click the recorder tool again to stop the recording (it will also stop if you close the window, or if you click on the recorder tool in another procedure editor window.)

You can use the recorded code as-is, or you can modify it as necessary. You can even edit it as it is being recorded! For example, if you make a mistake, you can delete it immediately, and then continue recording. You don’t even need to stop the recorder.

You can also go back and modify code you recorded before, even re-record parts of it. For example, I could take the code I just recorded and modify it to select Pennsylvania instead of California.

The recorder isn’t limited to simple tools – even complex dialogs can be recorded.

Recordable Actions

Most commands and tools that affect data can be recorded. Nothing bad happens if you perform an action that isn’t recordable (for example, inserting a field), but you will see that no code appears. So you can always try an action to see if it is recordable. Here is a detailed (but not necessarily comprehensive) list of recordable actions.

Recording Mouse Clicks

Clicking the mouse is not a recordable action. However, if you record an action where the current column position is important (for example sorting, grouping, or totalling) Panorama will add a Field statement to the recording to make sure that correct field is selected.

The recorder will ignore all other mouse clicks (for example, clicking on the scroll bar, dragging a window to a new position or changing the size of a window, etc.).

Panorama never records the row position of a click. In other words, if you click on a specific record, that is not recorded and does not become part of the code.

If you do want a Panorama procedure to move to a specific record you’ll need to use the find statement. You can either create this during recording using the Find/Select Dialog or simply by typing it into the procedure window.

find Name="David Tito"

Panorama will record the use of the up, down, first and last tools.

Recording Data Entry

Panorama can record any data values entered into database fields. In this example I create a procedure that will automatically create a new record that is pre-filled for San Francisco.

Of course if I run this procedure later it will create a new San Francisco record.

Recording Date Values

Panorama has special handling for recording of date values, as shown in this movie.

Recording Text Export

The commands in the File>Export menu are recordable. In this example, a procedure is recorded that sorts up by zip code and then does a comma-delimited export to the desktop.

For more complex exports you can record the Text Export Wizard. If you do this, you must complete the process by saving the export to a file with the Choose File dialog (dragging the text to the another application is not recordable).

Here’s a closer look at the recorded code. You can repeat this export at any time by running this procedure — without opening the Text Export Wizard again.

Aren’t you glad you didn’t have to write that code yourself?

Recording Text Import

The Text Import wizard is also recordable, with one restriction — you must import from a file. It does not record if importing from the clipboard or dragged text (because it has no way of re-creating the clipboard contents or dragged text when the procedure is run later). Here’s an example of code recorded by the Import Text wizard.

Adding Undo to Recorded Code

Most operations in Panorama can be undone, but by default, procedures you write aren’t Undo-able, whether you write them manually or record them (or both). For most procedures, however, adding undo support simply requires adding one line of code to the top of the procedure — startdatabasechange. For a typical recorded procedure that sorts, selects, or otherwise modifies more than one record in the database, you’ll want to use the "allrecords" option to tell Panorama that Undo needs to restore all records in the database. Here’s an example that takes the first recording shown above and adds the ability to Undo.

startdatabasechange "allrecords","Cities in California"
field "City"
select State match "CA"

When you run this procedure, then look in the Edit menu, you’ll see that you can Undo the effects of this procedure.

In the example above, the code manually specified the title that will appear in the Edit menu. You can use the info(“procedurename”) function to automatically specify that the name of the procedure be used. This way, even if the procedure is renamed, the Edit menu will have the correct title in the Undo item.

startdatabasechange "allrecords",info("procedurename")

If the procedure does nothing but change data in the current record, use "currentrecord" with the startdatabasechange statement, like this:

startdatabasechange "currentrecord",info("procedurename")
City = "San Francisco"
State = "CA"

But don’t use this option if more than one record is changed. Even if you just add a record and then modify it, that requires the use of the "allrecords" option.

startdatabasechange "allrecords",info("procedurename")
City = "San Francisco"
State = "CA"

To learn more about this topic, see the startdatabasechange statement.

See Also


10.0UpdatedCarried over from Panorama 6.0, but with a new user interface.