FastReport and FastReport Enterprise when the SQL is executed

Hello,

I have a report that has a dialog that accepts some of the required parameters from a couple of edit boxes and drop down lists. The edit box sets the SQL parameters using the [Params] dialog.

When the user clicks the [OK] button the following code is executed.
  aSQLtxt := repPurchase.SQL.Text;

  //Set the group type variable
  set(<GroupType>, cbGroup.ItemIndex);                                                                                                     

  //we need to make sure that the values entered are uppercase 
  edtactStart.text := Uppercase( edtActStart.text );
  edtActEnd.text   := Uppercase( edtActEnd.text );
  edtItmStart.text := Uppercase( edtItmstart.text );
  edtItmEnd.Text   := Uppercase( edtItmEnd.text );

  //we need to adjust the SQL statement based on the
  //selections made

  case edtOrders.ItemIndex of
   1: aSQLtxt := aSQLTxt + ' AND A.OrderConfirmed = ''Y'' ';
   2: aSQLtxt := aSQLTxt + ' AND A.OrderConfirmed = ''N'' ';
  end;

  //we now set the order of the report based on the
  //user selection

  case cbGroup.ItemIndex of
   0: aSQLTxt := aSQLTxt + ' Order by A.ItemCode, B.CloseDate ';
   1: asQLTxt := aSQLTxt + ' Order by B.AccountCode, B.CloseDate ';
  end;

  //set our SQL statement
  repPurchase.SQL.Text := aSQLtxt;


The SQL text is updated with the additional SQL text and the sort order.

SO HERE IS THE PROBLEM: When this is run from within the designer or using the TfrxReport component, the dialog box is displayed, the additional SQL text is added and the report runs with that new SQL text, all 100% as expected.

However, if I run the report with the TfrxReportClient or via a web-browser to the Report server, the dialog displays, the parameters that are linked to the edit boxes are used, but the report is executed with the original SQL text and not the additional Where clause and Order clause.

It would seem that the TfrxReportClient and connected server, execute the SQL statement before the TfrxReport component does...

Is there anyway around this...

The report will end up being run with the TfrxReportClient and I would like to use this method, rather than different reports for each of additional selection and order criteria.

Thanks

Simon



Comments

  • edited 8:26AM
    Well, does help if you check the examples...

    Placed the script in the OnDeactivate event and it works correctly on the TfrxReportClient and http browser.

    Simon

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.