Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread SQL Editing and Calc field issues
Mon, Mar 31 2008 5:56 PMPermanent Link

"Brian Kennedy"
Hi,

We have Report Builder 10.07 for Dephi 2006.  We provide canned reports =
(created with RB) in our application for our customers to use.  However, =
we also provide options for them to filter and group/order data by =
certain fields.  We retrieve the SQL for the report before running it =
and change it to meet our customers criteria.  Aftewards, we apply the =
SQL back to the report using the following procedure:

function SetReportSQL(const strSQL : String; const ppReport : TppReport;
const strQueryDataView : String =3D '') : Boolean;
var
daQueryDataView : TdaQueryDataView;
begin
SetReportSQL :=3D false;
// If report is valid...
if ppReport <> nil then
begin
 // Get query data view
 daQueryDataView :=3D GetReportQueryDataView(ppReport, =
strQueryDataView);
 // If view is valid, get SQL; if SQL is valid, set SQL string
 if daQueryDataView <> nil then with daQueryDataView do if SQL <> nil =
then
 try
  SQL.EditSQLAsText :=3D true;
  SQL.SQLText.Text :=3D strSQL;
  OutOfSync;
  SetReportSQL :=3D true;
 except
 end;
end;
end;

The problem occurs when we reference a field during an OnCalc event =
within the report using a variable.  Statements such as

Value :=3D History['Taxes']

will result in a null value, while

Value :=3D 10;

will work correctly.  The reports work fine as long as we do not attempt =
to change the SQL before running them.  So I am wondering if our =
SetReportSQL is incorrect or flawed in some manner.  Any help on this =
would be greatly appreciated.

Thank you.

Brian
Mon, Mar 31 2008 6:34 PMPermanent Link

"Brian Kennedy"
Oooops!  So sorry, I posted this in the wrong newsgroup...please delete my
post.  My apologies!

"Brian Kennedy" <briank@mtcpro.com> wrote in message
news:09768F0F-368D-4555-AECB-C06C380CB86F@news.elevatesoft.com...
Hi,

We have Report Builder 10.07 for Dephi 2006.  We provide canned reports
(created with RB) in our application for our customers to use.  However, we
also provide options for them to filter and group/order data by certain
fields.  We retrieve the SQL for the report before running it and change it
to meet our customers criteria.  Aftewards, we apply the SQL back to the
report using the following procedure:

function SetReportSQL(const strSQL : String; const ppReport : TppReport;
const strQueryDataView : String = '') : Boolean;
var
daQueryDataView : TdaQueryDataView;
begin
SetReportSQL := false;
// If report is valid...
if ppReport <> nil then
begin
 // Get query data view
 daQueryDataView := GetReportQueryDataView(ppReport, strQueryDataView);
 // If view is valid, get SQL; if SQL is valid, set SQL string
 if daQueryDataView <> nil then with daQueryDataView do if SQL <> nil then
 try
  SQL.EditSQLAsText := true;
  SQL.SQLText.Text := strSQL;
  OutOfSync;
  SetReportSQL := true;
 except
 end;
end;
end;

The problem occurs when we reference a field during an OnCalc event within
the report using a variable.  Statements such as

Value := History['Taxes']

will result in a null value, while

Value := 10;

will work correctly.  The reports work fine as long as we do not attempt to
change the SQL before running them.  So I am wondering if our SetReportSQL
is incorrect or flawed in some manner.  Any help on this would be greatly
appreciated.

Thank you.

Brian

Image