Changing SQL Object...
Hello!
I'm doing this procedure to call an interbase stored procedure from the
'FROM' statement....
1 - Create a Query with the Query Designer with same fields that the
procedure will return;
2 - Create in this Query the AutoSearchFields with same datatype that i need
get my procedure parameters;
3 - On the event Report.OnGetAutoSearchValues i'm changing the SQL object
with my sql;
4 - Re-link the datafields for the dbcomponents;
Here is the code:
procedure ReportOnGetAutoSearchValues;
var
sParam: string;
begin
sParam := IntToStr(Report.AutoSearchFields[0].Value) + ', ''' +
FormatDateTime('yyyy-mm-dd',
Report.AutoSearchFields[1].Values[0]) + ''', ''' +
FormatDateTime('yyyy-mm-dd',
Report.AutoSearchFields[1].Values[0]) + '''';
ChangeSQLObject(Report, 'select * from ESPELHO_PONTO(' + sParam + ')');
lblEmpresa.DataField := 'EMPRESA';
lblFuncao.DataField := 'FUNCAO';
lblCNPJ.DataField := 'CNPJ_EMPRESA';
lblNRO.DataField := 'NRO_REGISTRO';
lblHorario.DataField := 'HORARIO';
lblQuinzena.DataField := 'QUINZENA';
lblDataHora.DataField := 'DATA_HORA_ENTRADA';
HoraSai.DataField := 'DATA_HORA_SAIDA';
HoraEnt.DataField := 'DATA_HORA_ENTRADA';
lblFunc.DataField := 'FUNCIONARIO';
end;
Why, on the dbcomponent the value appear correctly in runtime, but when i
try to get it from RAP (i.e. test := mydataview[DATA_HORA_ENTRADA];) i'm
always get an empty value???
TIA.
I'm doing this procedure to call an interbase stored procedure from the
'FROM' statement....
1 - Create a Query with the Query Designer with same fields that the
procedure will return;
2 - Create in this Query the AutoSearchFields with same datatype that i need
get my procedure parameters;
3 - On the event Report.OnGetAutoSearchValues i'm changing the SQL object
with my sql;
4 - Re-link the datafields for the dbcomponents;
Here is the code:
procedure ReportOnGetAutoSearchValues;
var
sParam: string;
begin
sParam := IntToStr(Report.AutoSearchFields[0].Value) + ', ''' +
FormatDateTime('yyyy-mm-dd',
Report.AutoSearchFields[1].Values[0]) + ''', ''' +
FormatDateTime('yyyy-mm-dd',
Report.AutoSearchFields[1].Values[0]) + '''';
ChangeSQLObject(Report, 'select * from ESPELHO_PONTO(' + sParam + ')');
lblEmpresa.DataField := 'EMPRESA';
lblFuncao.DataField := 'FUNCAO';
lblCNPJ.DataField := 'CNPJ_EMPRESA';
lblNRO.DataField := 'NRO_REGISTRO';
lblHorario.DataField := 'HORARIO';
lblQuinzena.DataField := 'QUINZENA';
lblDataHora.DataField := 'DATA_HORA_ENTRADA';
HoraSai.DataField := 'DATA_HORA_SAIDA';
HoraEnt.DataField := 'DATA_HORA_ENTRADA';
lblFunc.DataField := 'FUNCIONARIO';
end;
Why, on the dbcomponent the value appear correctly in runtime, but when i
try to get it from RAP (i.e. test := mydataview[DATA_HORA_ENTRADA];) i'm
always get an empty value???
TIA.
This discussion has been closed.
Comments
dataview. Try using the variable's OnCalc event for this purpose.
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
the code.
I'm using a variable with datatype DATE, if i try to do
value := cadastro['DATA_HORA_ENTRADA'];
the variable always show current date and time, instead the date and time
that the database sent. (And the dbText is showing the correct value).
in rap??
i.e.:
ShowMessage(mydataview['FOO']);
but when the field 'foo' doesn't exist instead raising an exception,
RBuilder returns an empty str.