+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Adding/Changing Fields and Variables in Databound Mode

(combit Team) #1
Valid from List & Label 10
In the databound mode you normally don't have to deal with passing variables and fields. These are automatically passed from the data source.

If you would like to add additional fields/variables or influence the data from the data source, the databound components for .NET and Delphi/C++ Builder offer suitable events for you.

Important hint while using the VCL component:
If you are using the events in databound mode, you have to be sure to use the sender-object as List & Label reference for additional calls.

(1) Change fields

To change field names or contents of the data source, use the "AutoDefineField" event. Each field that is passed by data binding will trigger this event. Using the name and value event arguments, you can individually modify the name and content of each field that is passed to the print engine. You can also completely suppress fields, e.g.:

.NET:
private void LL_AutoDefineField(object sender, AutoDefineElementEventArgs e)
{
    if (e.Name == "internal")
    e.Suppress = True;
} 


Delphi:

procedure TForm1.DBL21_1AutoDefineField(Sender: TObject;
IsDesignMode: Boolean;
var FieldName, FieldContent: string; var FieldType: Integer;
var IsHandled: Boolean);

begin
    if FieldName = 'Customers.CompanyName' then
    IsHandled:=true;
end; 


(2) Pass additional fields

Use the “AutoDefineNewLine” event to add additional fields:

.NET:

private void LL_AutoDefineNewLine(object sender, AutoDefineNewLineEventArgs e)
{
    LL.Fields.Add("MyNewField", "A new field");
}


Delphi:

procedure TForm1.DBL21_1AutoDefineNewLine(Sender: TObject;
IsDesignMode: Boolean);

begin
    (Sender as TDBL21_).LlDefineField('MyNewField','A new field');
end; 


(3) Change variables

The “AutoDefineVariable” event corresponds to the “AutoDefineField” event, see (1)

(4) Pass additional variables

Use the “AutoDefineNewPage” event to pass additional variables.

.NET:

private void LL_AutoDefineNewPage(object sender, AutoDefineNewPageEventArgs e)
{
    LL.Variables.Add("MyNewVar", "A new variable");
} 


Delphi:

procedure TForm1.DBL21_1AutoDefineNewPage(Sender: TObject;
IsDesignMode: Boolean);

begin
    (Sender as TDBL21_).LlDefineVariable('MyNewVar','A new variable');
end; 


Note the AutoMasterMode property. It decides how master data will be passed in data bound mode. The values have the following effect:

AsVariables:
Master data is passed as variables, detail data as fields (e.g. invoice merge)

AsFields:
Master and detail data is passed as fields (e.g. invoice list)

IDKBTE000650 KBTE000650