Verwenden der Funktionen von Tabellendatenfeldern

Nachdem Sie die Tabellendaten aktiviert und die Quelle über die Eigenschaftsseite Tabellendaten des Tabellenobjekts ausgewählt haben, stehen Ihnen spezielle Datenquellen für Tabellendatenfelder zur Verfügung, die Ihnen bei der Gestaltung Ihrer Tabelle helfen. Diese Datenquellen für Tabellendatenfelder befinden sich im Fenster Datenquellen der Toolbox. Sie können sie in die Zellen einer Tabelle ziehen, um ein Textobjekt zu erstellen, das mit der Datenquelle verknüpft ist. Weitere Informationen darüber, wie Sie eine Datenquelle für ein Tabellenfeld zu einem Objekt hinzufügen, finden Sie unter Tabellen erstellen, die dynamische Daten verwenden.

Nachdem Sie eine Datenquelle für ein Tabellendatenfeld mit einem Objekt verknüpft haben, können Sie über die Eigenschaftsseite Datenquellen dessen Eigenschaften konfigurieren. Die Eigenschaftsseite enthält Einstellungen, die Sie zum Berechnen der Summe oder anderer Aggregatfunktionen in der Datenquelle „Tabellendatenfeld“ angeben können. Sie können auch den Bereich angeben, für den die Funktion berechnet wird.

Die folgenden Funktionstypen sind verfügbar:

Die folgenden Bereichsoptionen sind verfügbar:

Sie können eine Datenquelle für ein Tabellendatenfeld außerhalb der Tabelle verwenden, in der es definiert ist, aber wenn Sie dies tun, kann nur eine Aggregatfunktion für die Datenquelle verwendet werden. The function defaults to Sum, and for the range you can select All Records or Current Page (Current Group is not supported). Eine typische Anwendung für diese Konfiguration ist beispielsweise, den Gesamtpreis in einem Objekt außerhalb der Tabelle, in der es definiert ist, zu platzieren.

Beispiele

Use the examples in this section to become familiar with the basic steps for calculating a sum or other aggregate function in the Table Data Field data source. For each example, you must first create a new table object that is connected to a sample database and then configure a Table Data Field data source, as described in the following procedure.

If you want to go through the steps for both examples, you must create a separate BarTender document for each example.

GeschlossenCreating a Table Object that is Connected to a Database

The examples in this section require that you create a text file database that has a table that includes a Product field, a State field, and a Price field, such as the following sample database.

Produkt
Messer
Dish towel
Coffee mug
Gabel
Löffel
Zange
Hot pad
Dinner glass
Wine glass
Spatel
Teacup
Juice glass
Becher

State
WA
OR
CA
WA
WA
WA
OR
CA
CA
WA
CA
CA
NRW

Typ
Cutlery
Linens
Glassware
Cutlery
Cutlery
Implement
Linens
Glassware
Glassware
Implement
Glassware
Glassware
Glassware

Price
2.99
12.99
6.99
2.99
2.99
3.99
8.99
3.99
6.99
4.79
5.59
1.99
4.99

After you create the sample database, add a table object to your template that is connected to the database, and then sort the database fields according to the value in the State field. This procedure simultaneously creates a Table Data Field data source that appears on the Data Sources pane of the Toolbox.

GeschlossenTo add a table object that is connected to your database and then sort by the State field

  1. Klicken Sie in der Objektsymbolleiste auf das Symbol . Klicken Sie alternativ im Menü Erstellen auf Tabelle.

  2. Klicken Sie auf Tabelle aus Datenbank erstellen. The Database Setup wizard starts.

  3. Complete the wizard to connect to the sample database.

  4. In the Database Setup dialog, click Sort Order.

  5. In the Available Fields list, double-click State to add it to the Fields to Sort By list, and then click OK.

  6. Click the template at the location where you want to add the table object, and then drag the sizing handles to fit the table within the template.

GeschlossenBeispiel 1: Adding a Sum Aggregate Function

In this example, you will use the Table Properties dialog to configure a new row for the Sum aggregate function and then add the function, which will sum the prices for each State group.

GeschlossenTo configure the table properties

  1. Öffnen Sie das Dialogfeld Tabelleneigenschaften. Doppelklicken Sie dazu auf das Tabellenobjekt. Alternativ können Sie auch mit der rechten Maustaste auf das Objekt klicken und dann auf Eigenschaften.

  2. Klicken Sie im Navigationsfenster auf Zeilen, um die Eigenschaftsseite Zeilen aufzurufen.

  3. In the Rows area, click to add a new row.

  4. In the Row Properties area, under Table Data, follow these steps:

    1. Click Template, and then select Group Footer in the list.

    2. Click Group By, and then click to select the State check box in the list.

    3. Click Page Break, and then select Yes in the list. The table object displays a new, empty row.

  5. Click Close to close the Table Properties dialog.

GeschlossenTo add the Sum aggregate function

  1. On the Data Sources pane of the Toolbox, expand the Table 1 node under the Table Data Fields node.

  2. Drag the Price data source to the bottom right table cell under the existing Field: Price cell, as shown.

  3. Right-click the Field: Price object that you just created, and then click Properties to open the Text Properties dialog.

  4. On the Data Source tab, verify the following:

    • The Calculate sum or other aggregate function check box is selected.

    • The Function option is set to Sum.

    • The Range option is set to Current Group.

  5. Klicken Sie auf Schließen.

  6. Click Print Preview. Your items appear on three labels, grouped by the State field, with the total price calculated for each state and shown in the aggregate field that you added.

GeschlossenBeispiel 2: Adding a Count Aggregate Function

In this example, you will use the Table Properties dialog to configure a new row for the Count aggregate function and then add the function, which will count the number of products that are in each State group.

GeschlossenTo configure the table properties

  1. Öffnen Sie das Dialogfeld Tabelleneigenschaften. Doppelklicken Sie dazu auf das Tabellenobjekt. Alternativ können Sie auch mit der rechten Maustaste auf das Objekt klicken und dann auf Eigenschaften.

  2. Klicken Sie im Navigationsfenster auf Zeilen, um die Eigenschaftsseite Zeilen aufzurufen.

  3. In the Rows area, click to add a new row.

  4. In the Row Properties area, under Table Data, follow these steps:

    1. Click Template, and then select Group Footer in the list.

    2. Click Group By, and then click to select the State check box in the list.

    3. Click Page Break, and then select Yes in the list.

  5. Click Close to close the Table Properties dialog. The table object displays a new, empty row.

GeschlossenTo add the Count aggregate function

  1. On the Data Sources pane of the Toolbox, expand the Table 1 node under the Table Data Fields node.

  2. Drag the Product data source to the bottom left table cell under the existing Field: Product cell, as shown.

  3. Right-click the Field: Product object that you just created, and then click Properties to open the Text Properties dialog.

  4. On the Data Source tab, verify the following:

    • The Calculate sum or other aggregate function check box is selected.

    • The Function option is set to Count.

    • The Range option is set to Current Group.

  5. Klicken Sie auf Schließen, um das Dialogfeld zu schließen.

  6. Click Print Preview. Your items appear on three labels, grouped by the State field, with the total number of products calculated for each state and shown in the aggregate field that you added.