Printing multiple reports in one spool job using datasets and setting dataset parameters

I am trying to print a single report multiple times in one spool job using the code from the related solution "Delphi 7 ::: Rave Report - Several Reports Print in one spool job".  In the related example the programmer is getting data from a query dataset and passing the results to a rave report using report parameters.  
I on the other hand, am trying to set a dataset using parameters and then have the report use the results in a report which uses DataText and DataBand components.  I can get the report to print one at a time, but I get blank pages when running the report using the attached code by calling the TRvSystem components Execute method.
I checked the queries with the parameters set and they do return results with the correct number of rows of data.  As I stated above I have code elsewhere in my program which prints this report once using a seperate TRvProject component.  And it works with no problems.
procedure TPrintSpecDlg.rvsSpecsPrint(Sender: TObject); //TRvSystem.OnPrint
var MyIndex: integer;
    MyFlag: string;
begin
  rvpPrintSpecs.Open; //TRvProject
  if PrintSpecPricesCheckBox.Checked then
    MyFlag:= ''
  else
    MyFlag:= 'X';
  for MyIndex:= 0 to ItemsListBox.Count-1 do
  begin
    if ItemsListBox.Selected[MyIndex] then
    begin
      FAreaID:= (ItemsListBox.Items.Objects[MyIndex] as TItemRow).AreaID;
      FSpecID:= (ItemsListBox.Items.Objects[MyIndex] as TItemRow).ID;
      SetUpPrintQuery(FJobID, FAreaID, FSpecID);
      rvpPrintSpecs.SelectReport('rpSpec', TRUE);
      rvpPrintSpecs.SetParam('Test_Jibberish', MyFlag);
      GetMyOfc.ParamByName('iOfficeID').AsInteger:= FOfficeID;
      PrintMyItems.ParamByName('iJobID').AsInteger:= FJobID;
      PrintMyItems.ParamByName('iAreaID').AsInteger:= FAreaID;
      PrintMyItems.ParamByName('iItemID').AsInteger:= FSpecID;
      PrintMyInstrs.ParamByName('iJobID').AsInteger:= FJobID;
      PrintMyInstrs.ParamByName('iAreaID').AsInteger:= FAreaID;
      PrintMyInstrs.ParamByName('iItemID').AsInteger:= FSpecID;
      rvpPrintSpecs.ExecuteReport('rpSpec'); 
      (Sender as TBaseReport).NewPage;
    end;
  end;
end;
(*******************)
{ The following Code works fine but it only prints one report at a time }
{ I have this code elsewhere in my program in a datamodule }
{ It uses a seperate TRvProject and dataset components}
function TPrintDataModule.PrintSpec(const AOfficeID, AJobID, AreaID,
  ASpecID: integer; const ShowPrices: boolean): boolean;
var MyFlag: string;
begin
  . . . 
  . . . 
  SetUpPrintMyItem(AJobID, AreaID, ASpecID);
  if ShowPrices then
    MyFlag:= ''
  else
    MyFlag:= 'X';
  rvpPrint.Open;  //TRvProject
  try
    rvpPrint.SelectReport('rpSpec', TRUE);
    rvpPrint.SetParam('Test_Jibberish', MyFlag);
    GetMyOfc.ParamByName('iOfficeID').AsInteger:= AOfficeID;
    PrintMyItems.ParamByName('iJobID').AsInteger:= AJobID;
    PrintMyItems.ParamByName('iAreaID').AsInteger:= AreaID;
    PrintMyItems.ParamByName('iItemID').AsInteger:= ASpecID;
    PrintMyInstrs.ParamByName('iJobID').AsInteger:= AJobID;
    PrintMyInstrs.ParamByName('iAreaID').AsInteger:= AreaID;
    PrintMyInstrs.ParamByName('iItemID').AsInteger:= ASpecID;
    rvpPrint.Execute;
  finally
    rvpPrint.Close;
    . . .
  end; //try..finally
end;

Open in new window

3tproAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

3tproAuthor Commented:
Anyone ?
0
Geert GOracle dbaCommented:
just an idea, execute the report mulitple times ?

function TPrintDataModule.PrintSpec(const AOfficeID, AJobID, AreaID,
  ASpecID: integer; const ShowPrices: boolean; NumberOfCopies: Integer = 1): boolean;
var MyFlag: string;
  n: Integer;
begin
  . . . 
  . . . 
  SetUpPrintMyItem(AJobID, AreaID, ASpecID);
  if ShowPrices then
    MyFlag:= ''
  else
    MyFlag:= 'X';
  rvpPrint.Open;  //TRvProject
  try
    rvpPrint.SelectReport('rpSpec', TRUE);
    rvpPrint.SetParam('Test_Jibberish', MyFlag);
    GetMyOfc.ParamByName('iOfficeID').AsInteger:= AOfficeID;
    PrintMyItems.ParamByName('iJobID').AsInteger:= AJobID;
    PrintMyItems.ParamByName('iAreaID').AsInteger:= AreaID;
    PrintMyItems.ParamByName('iItemID').AsInteger:= ASpecID;
    PrintMyInstrs.ParamByName('iJobID').AsInteger:= AJobID;
    PrintMyInstrs.ParamByName('iAreaID').AsInteger:= AreaID;
    PrintMyInstrs.ParamByName('iItemID').AsInteger:= ASpecID;
    for n := 1 to NumberOfCopies do 
      rvpPrint.Execute;
  finally
    rvpPrint.Close;
    . . .
  end; //try..finally
end;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.