FastReport icon indicating copy to clipboard operation
FastReport copied to clipboard

How to inherited report with DataResource?

Open jonny-xhl opened this issue 4 years ago • 1 comments

  1. Create base.frx with MsSqlDataResource
  2. Inherited the base.frx

This way to create inherited reports How to modify the base report form connection change after the sub-report is followed by changes?

For example:

  • base.frx
<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Name="base" ReportInfo.Author="xx" ReportInfo.Version="v1.0" ReportInfo.Description="xx" ReportInfo.Created="04/27/2021 14:51:11" >
  <Dictionary>
    <MsSqlDataConnection Name="AIMSConnection" ConnectionString="rijcmlq++5g22xnSJ0Djm2w9m\9Y6eleOhdRaHVTigY6oELa1eyTjI7o+MkcZ/gmLDomYMttEDfbVilOLtmf/1KtWeFO0T7QLRQ5RwILP58x4j/1h/xIiu2vpqiIc9bEwtn4arPEv+DSiZjIlt6RSAKHjRATBvQ6v0Ax40B3iIXyXetusR0dchRxQw==">
      <TableDataSource Name="V_BASE_INFO" DataType="System.Int32" Enabled="true" TableName="V_BASE_INFO">
        ......
      </TableDataSource>
    </MsSqlDataConnection>
  </Dictionary>
  <ReportPage Name="BasePage勿动">
    <ReportTitleBand Name="BaseReportTitle" Width="718.2" Height="37.8"/>
    <PageHeaderBand Name="BasePageHeader" Top="41.8" Width="718.2" Height="28.35"/>
    <DataBand Name="BaseData" Top="74.15" Width="718.2" Height="75.6"/>
    <PageFooterBand Name="BasePageFooter" Top="153.75" Width="718.2" Height="18.9" Visible="false"/>
  </ReportPage>
</Report>
  • sub-report
<?xml version="1.0" encoding="utf-8"?>
<inherited BaseReport="base.frx" ScriptLanguage="CSharp" >
  <Dictionary>
    <MsSqlDataConnection Name="AIMSConnection" ConnectionString="rijcmlq++5g22xnSJ0Djm2w9mOsmHIND51e9mGPQ6oELZ/gmLDomYMttEDfbVilOLtmf/1KtWeFO0T7QLRQ8x4j/1h/xIiu2vpqiIc9bEwtn4arPEv+DSiZjIltMtqY11A0ZiNyscX93+L6RSAKHjRATBvQ6v0Ax40B3iIXyXetusR0dchRxQw==">
      <TableDataSource Name="V_BASE_INFO" DataType="System.Int32" Enabled="true" TableName="V_BASE_INFO">
        ......
      </TableDataSource>
    </MsSqlDataConnection>
  </Dictionary>
  <inherited Name="BasePage勿动">
    <inherited Name="BaseReportTitle"/>
    <inherited Name="BasePageHeader"/>
    <inherited Name="BaseData"/>
    <inherited Name="BasePageFooter"/>
  </inherited>
</inherited>

The sub-report also carries a connection string, how do I only change only to the foundation?

jonny-xhl avatar Apr 27 '21 07:04 jonny-xhl

good

ArmyMedalMei avatar Apr 28 '21 06:04 ArmyMedalMei

Let me clarify - you want to change the base report connection after you edit it in the inherited report? That functionality isn't present, and I don't think it will be added. Quoting the user manual:

The report inheritance was designed to meet the following goal: save common report elements such as headers and footers in separate files, and reuse them in inherited reports.

Therefore a change like this would go against the base idea of report inheritance.

Alekarfes avatar Jan 11 '24 11:01 Alekarfes