Example - Creating a profit and loss table with vertical bands
In this example, we use vertical bands to create a profit and loss report outlining the total sales and profit for each year in the app.
Refer to the example app sources here: Voorbeeldmateriaal - In-app rapportage. Upload the app and data files into a space, and then reload the app. You are ready to complete the example.
Step 1: Create data binding
Doe het volgende:
-
Create a new PixelPerfect template.
-
Open the
Field List menu available from the right-side panel in the designer.
Field List menu in the PixelPerfect designer
-
Hover your cursor over Levels, and then click
.
-
Expand the Sales Tables sheet. Next to P&L by Year, click
.
The data binding is created.
Step 2: Create the banded structure
Doe het volgende:
-
On the design surface, right-click anywhere within the Detail1 band and click Insert Band > DetailReport.
A new DetailReport band is inserted below Detail1.
-
Right-click the DetailReport band. Click Insert Vertical Band > VerticalHeader.
VerticalHeader and VerticalDetail bands are added.
-
Right-click the DetailReport band again. Click Insert Vertical Band > VerticalTotal.
A VerticalTotal band is added.
You can reduce the width of the bands to save space.
Step 3: Connect the structure to data binding
Doe het volgende:
-
Select the DetailReport band that contains the vertical bands.
-
Click the gear icon at the edge of the design surface.
Clicking the gear icon
-
In the menu, select the P&L by Year level as the Data Member.
TipAlternatively, clickat the far right of the designer. Add the Data Member under Detail Report Tasks.
Step 4: Add headers
Doe het volgende:
-
From the toolbox on the left side of the designer, drag three
Label objects onto the VerticalHeader1 band, stacking them horizontally as a series of three rows.
-
Double-click each label and give them the following fixed text, respectively:
-
Year
-
Total Sales
-
Total Profit
-
-
From the toolbox on the left side of the designer, drag a
Label object onto the top of VerticalTotal1, arranging it so it is parallel with the Year label. Double-click the label and give it the following fixed text: All Time
Step 5: Add data to template
Doe het volgende:
-
Open the
Field List menu, and expand Levels.
-
Within the P&L by Year level, drag the following fields onto the VerticalDetail1 band, stacking them horizontally as a series of three rows. They should be in this order:
-
OrderYear
-
Sales
-
Profit
-
-
Select the Sales field you just added.
-
Click the gear icon at the edge of the design surface.
-
In the popout menu, click the ellipsis (three dots) menu under Text Format String.
-
The Format String Editor dialog opens. Choose Currency, and adjust the decimal points. Click OK.
-
Repeat this process for the Profit field.
-
Copy the Sales and Profit fields, and paste them onto the VerticalTotal1 band so that the pasted fields are parallel to the original fields.
Step 6: Configure the total calculations
We need to configure the newly pasted Sales and Profit fields to summarize all data from the table columns.
Doe het volgende:
-
Select the Sales field you pasted within the VerticalTotal1 band.
-
Open the
Properties menu from the right side panel. Expand Data, and then expand Summary.
-
Set Running to Report.
-
Return to the design surface. Click the bold f icon near the selected Sales field to open the Expression Editor.
-
In the Expression Editor, enter the following expression:
sumSum([P&L by Year (P&L by Year_Level).Sales])
-
Repeat this entire process for the Profit field you pasted within the VerticalTotal1 band, but instead use this expression:
sumSum([P&L by Year (P&L by Year_Level).Profit])
Customize font properties in the Properties menu under Appearance > Font.
Report template for profit and loss table

Click Save template, and then click Preview report. Download the report and open it.
Report preview
