Skip to content

Add comprehensive documentation for data binding and looping through data in reports#247

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/bind-data-source-to-report
Draft

Add comprehensive documentation for data binding and looping through data in reports#247
Copilot wants to merge 3 commits intomasterfrom
copilot/bind-data-source-to-report

Conversation

Copy link
Contributor

Copilot AI commented Oct 19, 2025

Overview

Closes the issue asking "How do I loop the textbox in the report? And bind the data source?" by providing comprehensive documentation and examples.

What's New

📚 Main Documentation (docs/DataBinding-and-Looping.md)

A complete 16KB guide covering:

  • Understanding Data Binding: Explains core concepts (DataSource, DataSet, Fields, Report Items)
  • Three Methods of Binding Data:
    1. Database connection via RDL definition
    2. Programmatic binding using C# and DataTables
    3. Using RdlCreator to generate reports from queries
  • Looping Through Data: Detailed explanation of how Table elements with Details sections automatically loop through dataset rows
  • Textbox Binding: How to bind textboxes to data fields using =Fields!FieldName.Value
  • Code Examples: Multiple complete C# and RDL examples for common scenarios
  • Advanced Topics: Master-detail reports, grouping, conditional formatting
  • Best Practices & Troubleshooting: Common issues and solutions

📖 Examples Documentation (Examples/README.md)

A quick reference guide that:

  • Provides overview of all example projects in the repository
  • Shows common patterns with code snippets
  • Links to the comprehensive documentation
  • Explains the sample database (northwindEF.db)

🎯 Annotated Example (Examples/SimpleDataBindingExample.rdl)

A working, well-commented RDL file demonstrating:

<!-- Details Section (repeats for EACH row in dataset) -->
<!-- This is where the "looping" happens! -->
<Details>
  <TableRows>
    <TableRow>
      <TableCells>
        <TableCell>
          <ReportItems>
            <Textbox Name="ProductName">
              <Value>=Fields!ProductName.Value</Value>
            </Textbox>
          </ReportItems>
        </TableCell>
      </TableCells>
    </TableRow>
  </TableRows>
</Details>

🔗 Updated Main README

Added a "Common Topics" section under Documentation with direct link to the data binding guide.

Key Questions Answered

Q: How do I loop the textbox in the report?

A: Use a <Table> element with a <Details> section. Each <Textbox> in the Details section automatically repeats for every row in your dataset:

<Table Name="MyTable">
  <DataSetName>MyData</DataSetName>
  <Details>
    <TableRows>
      <TableRow>
        <TableCells>
          <TableCell>
            <ReportItems>
              <Textbox Name="MyField">
                <Value>=Fields!MyField.Value</Value>
              </Textbox>
            </ReportItems>
          </TableCell>
        </TableCells>
      </TableRow>
    </TableRows>
  </Details>
</Table>

Q: How do I bind the data source?

A: Several methods are documented:

// Method 1: Programmatically with DataTable
await rdlViewer1.SetSourceFile(new Uri(reportPath));
await (await rdlViewer1.Report()).DataSets["Data"].SetData(dataTable);
await rdlViewer1.Rebuild();

// Method 2: Using RdlCreator
var creator = new Majorsilence.Reporting.RdlCreator.Create();
var report = await creator.GenerateRdl(
    "Microsoft.Data.Sqlite",
    connectionString,
    query,
    pageHeaderText: "My Report"
);

Changes Summary

  • 4 files changed: 992 insertions
  • Documentation only: No code changes, zero security risk
  • Backward compatible: No breaking changes
  • Properly linked: Main README updated to reference new docs

This documentation should significantly help new users understand how to work with data in Majorsilence Reporting.

Original prompt

This section details on the original issue you should resolve

<issue_title>bind the data source?</issue_title>
<issue_description>Hi, I have a question, how do I loop the textbox in the report?And bind the data source?thx!</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #187


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits October 19, 2025 19:41
…data

Co-authored-by: majorsilence <656288+majorsilence@users.noreply.github.com>
Co-authored-by: majorsilence <656288+majorsilence@users.noreply.github.com>
Copilot AI changed the title [WIP] Bind data source to report textboxes Add comprehensive documentation for data binding and looping through data in reports Oct 19, 2025
Copilot AI requested a review from majorsilence October 19, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bind the data source?

2 participants