Add

Monday, August 24, 2009

C/SIDE Temporary Table

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.
You can use a temporary table just like you use a database table. The differences between a temporary table and a database table are:
1. A temporary table is not stored in the database, but is only held in memory until the table is closed.
2. The write transaction principle that applies to a database table does not apply to a temporary table.
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 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.
1. On the Tools menu, click Object Designer, and then create a new 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.
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.
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.


No comments: