I have an little app which processes different reports, and i have variables which differs each other, in order to keep it simple and readable, i use the method
TfrReport.Values.FindVariable('MyVar').Field to set it up in a procedure, my main problem is setting variables in OnGetValue event are easy, but FindVariable method no.
After researching a lot about for my problem, it simply doesn't work.
my procedure is like this (this loads a lot of specific data into variables specified for each type of report i have)
procedure TBoletaViewerForm.SetRecordsData;
begin
frReport1.Values.FindVariable('FieldVarTest').Field := 'TEST' ;
end;
This code is called on the FormShow event, with the following code:
frReport1.LoadFromFile(FReportFile);
if frReport1.PrepareReport then begin
SetRecordsData;
frReport1.ShowPreparedReport;
end;
The FindVariable('FieldVarTest') function finds the variable and sets it up in the Field property correctly, but doesn't display anything in the report, if i move that in the OnGetValue event instead like this:
if ParName = 'FieldVarTest' then ParValue := 'Test Field Working!';
works as intended.
I've tried a lot of alternatives such frVariables.Variables and doesn't work too, and a lot of answers points to the same FindVariable() but doesn't work neither. i getting a bit burnout trying to solve this.
Thanks.