Business Integration Solutions Documentation Documentation

About: Temporary Table Handler

When exporting data from BC, an internal document gives you the option to manipulate data without commiting anything to the database, by using the temporary table handler. This must be done in the documents properties, at the table level.

First you have to check the "Use a temporary table" property and then specify the custom handler that you want to be used alongside the filter that needs to be applied. The incoming record on your custom connector contains multiple filters applied accross filter groups to ensure it's scope. Filters are not cleared nor reapplied.

FilterGroup Contains filters from
Group 0 Message Filters
Group 4 Filter set on "Link Fields" (General Properties)
Group 5 Filter set on "Table Filter" (Export Properties)

"Use a temporary table" property is optional, but please note that any changes applied to the records in your custom connector may be applied to the database as well

The custom handler must have the same table no as its source, as the one from your internal document, and implement the trigger OnRun, where all the logic goes (an example below).

The custom handler is retriggered each time when the node is hit, which in some cases might mean multiple times if the node in discussion is a child of another node.

Filter setup from the document are applied to the Rec variable in different filter groups, see "Filter group" table above, clearing those may have unforseen consequences.

The above mentioned filters can be retrieved from the Rec variable from their coresponding filtergroup if one needs to manipulate them.

codeunit 50000 YourTempTableHandler
{
    TableNo = YourTableNo

    trigger OnRun()
    var
        LocaVariable: Record YourTableNo;
    begin 
        if not Rec.IsTemporary() then
            !check to ensure your buffer is temporary
            error ('Your buffer should be temporary');

        !Use filter group 4 for accessing the table relation filters
        !LocalVariable.FilterGroup(4);
        
        !Use filter group 5 for accessing the export table filters
        !LocalVariable.FilterGroup(5);
        
        !Use filter group 0 for accessing incomming message filters
        !LocalVariable.FilterGroup(0);
        
        LocalVariable.CopyFilters(Rec);

        if LocalVariable.FindFirst() then begin 
            !modify the data here
            Rec := LocalVariable;
            Rec.Field := NewValue;
            Rec.Modify();
        end;
    end;
}

DocumentLinesProperties