SQL property access
Hi,
Hi, I have this report, where the user selects the data column by which the report is ordered. I created a report variable "order", and within the report, using pascal scripting, I want to assign a value to the SQL property of a DBXQuery component, the corresponding SQL statement; I tried with:
procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
if Get('orden') = 'proveedor' then
begin
DBXQuery_regoper_part.SQL:='select
regoper_part_id,
regoper_id,
proveedor_id,
prv_rfc,
prv_nombre,
RPP_NUMPARTIDA,
rpp_numpoliza,
rpp_numfactura,
rpp_mesfactura,
rpp_iva,
rpp_importe
from regoper_part_v
where regoper_id = :regoper_id
order by PRV_NOMBRE';
end;
end;
I get expression expected. How can I properly code this assignation?
Thank you
Hi, I have this report, where the user selects the data column by which the report is ordered. I created a report variable "order", and within the report, using pascal scripting, I want to assign a value to the SQL property of a DBXQuery component, the corresponding SQL statement; I tried with:
procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
if Get('orden') = 'proveedor' then
begin
DBXQuery_regoper_part.SQL:='select
regoper_part_id,
regoper_id,
proveedor_id,
prv_rfc,
prv_nombre,
RPP_NUMPARTIDA,
rpp_numpoliza,
rpp_numfactura,
rpp_mesfactura,
rpp_iva,
rpp_importe
from regoper_part_v
where regoper_id = :regoper_id
order by PRV_NOMBRE';
end;
end;
I get expression expected. How can I properly code this assignation?
Thank you
Comments
Look at main demo internaldatasets internalquery report
look at the sql and the parameters of the query.
I found that the following code does not have syntax errors:
Yet when executing it, I get: "Undeclared identifier "proveedor""
In Delphi, when calling this report I have:
Self.frxReport_regoper.Variables.Variables:= 'proveedor';
Self.frxReport_regoper.ShowReport();
Is the script code " if Get('orden') = 'proveedor' then" correct? or am I missing something?
Thank you
Thank you for your reply; I tryed something like:
(Delphi)
Self.frxReport_regoper.Variables.Variables:= DataSource.DataSet.FieldByName( objetoBD.z_campoId ).AsString;
Self.frxReport_regoper.Variables.Variables:= 'PRV_NOMBRE';
Self.frxReport_regoper.ShowReport();
Then, in the Report query (DBXQuery_regoper_part.SQL):
select
regoper_part_id,
regoper_id,
proveedor_id,
prv_rfc,
prv_nombre,
RPP_NUMPARTIDA,
rpp_numpoliza,
rpp_numfactura,
rpp_mesfactura,
rpp_iva,
rpp_importe
from regoper_part_v
where regoper_id = :regoper_id
order by :orden
And I get:
:-(
"Undeclared identifier PRV_NOMBRE"
Any ideas?
read the programmers manual on working with variables