Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Oracle Delphi XE2中的FastReport主/详细信息_Oracle_Delphi_Fastreport - Fatal编程技术网

Oracle Delphi XE2中的FastReport主/详细信息

Oracle Delphi XE2中的FastReport主/详细信息,oracle,delphi,fastreport,Oracle,Delphi,Fastreport,我需要一些帮助在Delphi XE2的快速报告中创建主/详细报告 我有一个简单的表单,它接受来自用户的2个日期和2次。然后,我在表单上有2个Oracle数据集,用于检索我的数据。当用户按下“打印”按钮时,程序接受来自用户的值并将值发送到第一个oracle数据集,然后oracle数据集依次检索第一个值,然后将该值连同用户接受的值一起发送到第二个数据集,以打印与检索到的值相关的详细信息 对于每个数据集,我都有一个相应的frxDBDataset组件,然后将其分配给frxReport1组件。在报告中,我

我需要一些帮助在Delphi XE2的快速报告中创建主/详细报告

我有一个简单的表单,它接受来自用户的2个日期和2次。然后,我在表单上有2个Oracle数据集,用于检索我的数据。当用户按下“打印”按钮时,程序接受来自用户的值并将值发送到第一个oracle数据集,然后oracle数据集依次检索第一个值,然后将该值连同用户接受的值一起发送到第二个数据集,以打印与检索到的值相关的详细信息

对于每个数据集,我都有一个相应的frxDBDataset组件,然后将其分配给frxReport1组件。在报告中,我创建了一个分配给dataset1的主标注栏和一个分配给datset2的详细标注栏。当我运行报表时,数据集1会带回所有记录,但数据集2只带回第一个值的记录,并对数据集1中的每个记录进行复制

下面是我试图执行的代码:

opr_operator_ods.Close;
opr_operator_ods.SetVariable('DATEFROM', opr_datefrom_dtp.Date);
opr_operator_ods.SetVariable('DATETO', opr_dateto_dtp.Date);
opr_operator_ods.SetVariable('TIMEFROM', opr_timefrom_dtp.Text);
opr_operator_ods.SetVariable('TIMETO', opr_timeto_dtp.Text);
opr_operator_ods.Open;

if opr_operator_ods.RecordCount > 0 then
begin
while not opr_operator_ods.Eof do
begin
opr_operatorcount_ods.Close;
opr_operatorcount_ods.SetVariable('DATEFROM', opr_datefrom_dtp.Date);
opr_operatorcount_ods.SetVariable('DATETO', opr_dateto_dtp.Date);
opr_operatorcount_ods.SetVariable('TIMEFROM', opr_timefrom_dtp.Text);
opr_operatorcount_ods.SetVariable('TIMETO', opr_timeto_dtp.Text);
opr_operatorcount_ods.SetVariable('OPERATOR',
opr_operator_ods.FieldByName('opr_code').AsString);
opr_operatorcount_ods.Open;

while not opr_operatorcount_ods.Eof do
begin
frxReport1.PrepareReport(false);
opr_operatorcount_ods.Next;
end;
frxReport1.PrepareReport(true);
opr_operator_ods.Next;
end;

DecodeDate(opr_datefrom_dtp.Date, tyear, tmonth, tday);
StartDate := '''' + IntToStr(tday) + '/' + IntToStr(tmonth) + '/' + IntToStr(tyear) + '''';
DecodeDate(opr_dateto_dtp.Date, tyear, tmonth, tday);
EndDate :=  '''' + IntToStr(tday) + '/' + IntToStr(tmonth) + '/' + IntToStr(tyear) + '''';

frxReport1.Variables['StartDate'] := StartDate;
frxReport1.Variables['EndDate'] := EndDate;

//frxReport1.PrepareReport(True);
frxReport1.ShowPreparedReport;
如何获取第二个数据集以继续下一个记录的值


该报告过去在Delphi 2005中与RaveReports6完美结合,但在那里我们使用了基于代码的表单开发,它更易于使用“writeln”进行操作,而不像快速报告那样直观。

创建预览快速报告时,会执行以下代码:

while not MasterBand.DataSet.Eof do
  begin
    ...Do special FastReport's work :)
    while not DetailBand.DataSet.eof do 
      begin
        ...Do special FastReport's work :)
        DetailBand.DataSet.Next; 
      end;
    MasterBand.DataSet.Next;   
 end;
在代码中:

while not opr_operatorcount_ods.Eof do
begin
 frxReport1.PrepareReport(false);
 opr_operatorcount_ods.Next; <-- here opr_operatorcount_ods is in the last position from PrepareReport 
end;  
然后准备并打印报告,如下所示:

procedure Print;
begin
  //Prepare Master dataset ( parameters, close open etc.) like :
  opr_operator_ods.Close;
  opr_operator_ods.SetVariable('DATEFROM', opr_datefrom_dtp.Date); 
  opr_operator_ods.SetVariable('DATETO', opr_dateto_dtp.Date);
  opr_operator_ods.SetVariable('TIMEFROM', opr_timefrom_dtp.Text);
  opr_operator_ods.SetVariable('TIMETO', opr_timeto_dtp.Text);
  opr_operator_ods.Open;
  ... 
  frxReport1.PrepareReport;
  frxReport1.ShowPreparedReport;
end; 
procedure Print;
begin
  //Prepare Master dataset ( parameters, close open etc.) like :
  opr_operator_ods.Close;
  opr_operator_ods.SetVariable('DATEFROM', opr_datefrom_dtp.Date); 
  opr_operator_ods.SetVariable('DATETO', opr_dateto_dtp.Date);
  opr_operator_ods.SetVariable('TIMEFROM', opr_timefrom_dtp.Text);
  opr_operator_ods.SetVariable('TIMETO', opr_timeto_dtp.Text);
  opr_operator_ods.Open;
  ... 
  frxReport1.PrepareReport;
  frxReport1.ShowPreparedReport;
end;