ADOQuery1 inside report

edited March 2014 in FastReport 4.0
Hi is it possible to filter by date by parameter like this inside the report and make a trend?
Thank??s


procedure ChangeParamDate(Param: TParameter; const Value: TDateTime);
begin
Param.Value := Value;
Param.DataType := ftDate;
end;

begin
with qerymatdata do
begin
Close;
SQL.Text :=
'SELECT '+
'a.Codigo, '+
'a.Designacao, '+
'Sum(a.Quantidade) AS SomaDeQuantidade, '+
'FORMAT(a.data_hora, ''dd.yyyy'') AS [MonthAndYear] '+
'FROM Materiais_obraRel AS a '+
'WHERE (a.data_hora BETWEEN @DataInicDate AND @DataFinalDate) '+
'GROUP BY '+
'Year(a.data_hora), '+
'Month(a.data_hora), '+
'a.Codigo, '+
'a.Designacao, '+
'FORMAT(a.data_hora, ''dd.yyyy'') '+
'ORDER BY '+
'a.Codigo, '+
'a.Designacao ';

ChangeParamDate(Parameters.ParamByName('@DataInicDate'), datainic.DateTime);
ChangeParamDate(Parameters.ParamByName('@DataFinalDate'), datafinal.DateTime);
Open;
end;
end;

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.