Export (0) Print
Expand All

C/SIDE Temporary Tables

Microsoft Dynamics Nav 2009

A temporary table is a temporary variable that holds a table. A temporary table is used as a buffer for table data in your C/AL programs. For more information about C/AL, see Introduction to C/AL.

You can use a temporary table just like you use a database table. The differences between a temporary table and a database table are:

  • A temporary table is not stored in the database, but is only held in memory until the table is closed.

  • The write transaction principle that applies to a database table does not apply to a temporary table. For more information, see Write Transactions and Recovery.

Dd355211.Local_1075152796_nav_adg_8_diag_8(en-us,NAV.60).gif

Advantage of a Temporary Table

The advantage of using a temporary table is that all the interaction with a temporary table takes place on the client. This reduces the load on both the network and the server.

When you need to perform many operations on the data in a specific table in the database, you can load the data into a temporary table while you modify it. Loading the data into a temporary table speeds up the process because all the operations are performed locally on the client.

Defining and Using a Temporary Table

You must define the temporary table before you can use it in your C/AL code. The variable that holds a temporary table is defined just like any other global or local variable.

To define a temporary table

  1. On the Tools menu, click Object Designer, and then create a new table.

    For information about how to create a table, see How to: Create a Table.

  2. Click View, and then click C/AL Globals or C/AL Locals, depending on whether your variable is going to be global or local.

    If you choose C/AL Globals, the C/AL Globals window appears.

    Dd355211.Local_2079194835_nav_adg_8_table_31(en-us,NAV.60).gif
  3. Enter a name for the temporary table variable, and enter or select Record as the data type. Use the lookup button in the Subtype field to select the table to copy.

  4. With the cursor still on the line that defines the temporary table, click View, and then click Properties (SHIFT+F4) to display the Properties window.

    Dd355211.Local_2079194832_nav_adg_8_table_32(en-us,NAV.60).gif
  5. Change the value of the Temporary property to Yes.

After you have created a temporary table, you can use it in your C/AL code. You can apply filters and perform searches just as you can with a database table.

See Also

Other Resources

Special C/SIDE Tables

Community Additions

ADD
Show:
© 2014 Microsoft