How To - Use the SourceTableTemporary property

The SourceTableTemporary is a new property introduced in 5.0 giving all kinds of new capabilities of showing data that is not even in the database.

Instead of showing real data from the database, the form is running on an empty table when starting up, so you will have to populate it with data.

Step 1.

Create a normal form with the wizard and define your sourcetable. Select the columns you want to (ab)use.

Make sure to select the SourceTableTemporary property.

In our example we will use table 18, Customer and select columns No. and Name.

Step 2.

Create a new function "InitTempTable"

In this function define a Local variable "Cust", type Record, Subtype 18. (Customer).

Write the following piece of C/AL Code

Code:
Cust.SETFILTER(Balance, '>1000');
Cust.SETFILTER("Country/Region Code" , 'NL');
If Cust.FINDSET THEN REPEAT
  Rec := Cust;
  INSERT;
UNTIL Cust.NEXT = 0;

Cust.SETFILTER(Balance, '>500');
Cust.SETFILTER("Country/Region Code" , '<>NL');
If Cust.FINDSET THEN REPEAT
  Rec := Cust;
  INSERT;
UNTIL Cust.NEXT = 0;


Step 3

Go to the OnOpenForm trigger and put the new function in there.

Result

A view of your customers with a filter that is normaly not possible with the normal filters still available.

The idea and example are from form 634 Chart of Accounts Overview in 5.0. You'll also find a great example there of how to expand and collapse.

For a customer I've built a view combining 2 tables based on a date filter with quantities summed up from other tables. It is very easy to use and setup and when using proper indexing the performance is perfect.

Good luck.

Comment List
Related
Recommended