ActiveReports 18 .NET Edition
Report Authors / Design Reports / Design Section Reports / Tutorials: Report Controls in Section Reports / TextBox Control
In This Topic
    TextBox Control
    In This Topic

    Let us create a report that uses TextBox controls to display the price and total number of items in stock. The report connects to the 'Products' JSON data available here.

    The final report will look as shown.

    Section report using TextBox Controls

    Create a Report

    In the ActiveReports Designer, create a new Section report. 

    Bind Report to Data

    1. As you create a new report, the Report Data Source dialog appears for you to configure the report data connection. You can also access this dialog by clicking the Data Source Data Source Icon icon on the Detail section.
    2. In the dialog, go to the JSON page and click Build to open the Configure JSON Data Source dialog.
    3. Enter the following URL in the Data Path as follows:
      https://demodata.mescius.io/northwind/odata/v1/Products
    4. Click OK to close the dialog.
      The Connection String section displays the connection string as follows:
      Connection String
      Copy Code
      jsondoc=https://demodata.mescius.io/northwind/odata/v1/Products
      
    5. Click OK to save the changes and close the Report Data Source dialog.
    6. To fetch the required fields, enter the following query in the JSON Path.
      Query
      Copy Code
      $.value[*]
      

    Design Report Layout

    1. Drag the following data fields to the Detail section of the report: ProductId, UnitPrice, and UnitsInStock. All these fields are bound text boxes.
    2. To provide headings (labels) to the data displayed in the text boxes in Detail section, drag and drop three Label controls onto the Page Header section of the report and set the Text property of the text boxes to 'Product ID', 'Unit Price', and 'Units In Stock', respectively.
    3. To display the total number of products in stock, drag and drop two TextBox controls onto the Footer section of the report and set the properties as follows.
      • TextBox1: Set the Text property to Total:. This is an unbound text box.
      • TextBox2: Set the DataField property to UnitsInStock and SummaryType property to GrandTotal. This textbox will show the total number of products in stock.
    4. To provide the report's title, drag and drop another TextBox control onto the top center in the PageHeader section. Enter the text of the title into the Text property or directly inside the text box, e.g. 'Products Info'.
    5. To add the information on the report generation date, drag and drop the ReportInfo control on the upper right corner of the PageHeader section and set the FormatString property to the expression: Report Generation Date: {RunDateTime:dd/MMM/yyyy}.
      Sample Report Layout
    6. Modify the appearance of the report and preview.
    See Also