SearchCriteria and Global variables.
Hi there,
I'm using RB 6.03 and D&.
I have a report that consists of several dataviews. How many dataviews there
is, is not known prior to loading the report. The report is loaded into the
TppReport from file. All the dataviews needs the same inputvalue in the
searchcriteria. I do'nt need to display a dialog to set this inputvalue. The
code below shows how i create a global variable and assign a value to it.
if GetCodeObject(rptMain,lCodeModule) then
begin
lCreateProgram := lCodeModule.GlobalCreateProgram;
if (lCreateProgram=nil) then
begin
lCreateProgram := TraProgram.Create;
lCreateProgram.ProgramName := 'GlobalOnCreate';
lCreateProgram.ChildType := ctCreateProgram;
lCreateProgram.ProgramType := ttProcedure;
lCreateProgram.SourceLines.Clear;
lCreateProgram.SourceLines.Add('procedure GlobalOnCreate; ');
lCreateProgram.SourceLines.Add('begin ');
lCreateProgram.SourceLines.Add(' KontraktNummer := '+AValues+';
');
lCreateProgram.SourceLines.Add('end; ');
lCodeModule.GlobalCreateProgram := lCreateProgram;
lCodeModule.DSExclude([pppcEmpty]);
lCodeModule.BuildAll(true);
end;
end;
My question is. How can i assign the value of this global variable to the
searchcriteria of each dataview?
Thanks,
Terje
I'm using RB 6.03 and D&.
I have a report that consists of several dataviews. How many dataviews there
is, is not known prior to loading the report. The report is loaded into the
TppReport from file. All the dataviews needs the same inputvalue in the
searchcriteria. I do'nt need to display a dialog to set this inputvalue. The
code below shows how i create a global variable and assign a value to it.
if GetCodeObject(rptMain,lCodeModule) then
begin
lCreateProgram := lCodeModule.GlobalCreateProgram;
if (lCreateProgram=nil) then
begin
lCreateProgram := TraProgram.Create;
lCreateProgram.ProgramName := 'GlobalOnCreate';
lCreateProgram.ChildType := ctCreateProgram;
lCreateProgram.ProgramType := ttProcedure;
lCreateProgram.SourceLines.Clear;
lCreateProgram.SourceLines.Add('procedure GlobalOnCreate; ');
lCreateProgram.SourceLines.Add('begin ');
lCreateProgram.SourceLines.Add(' KontraktNummer := '+AValues+';
');
lCreateProgram.SourceLines.Add('end; ');
lCodeModule.GlobalCreateProgram := lCreateProgram;
lCodeModule.DSExclude([pppcEmpty]);
lCodeModule.BuildAll(true);
end;
end;
My question is. How can i assign the value of this global variable to the
searchcriteria of each dataview?
Thanks,
Terje
This discussion has been closed.
Comments
Try downloading the following example. It shows how to extract a DataView's
TdaSQL object and access the TdaCriteria objects. The
TdaDataModule.DataViews[] array property and the TdaDataModule.DataViewCount
property can be used to iterate thru the dataviews associated with a report.
http://www.digital-metaphors.com/tips/ExtractSQLObject.zip
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com