如何以3 * 3格式的快速报告显示数据? [英] How to show data at Fast Report in 3*3 grid format?
问题描述
我想以FastReport的格式显示来自表格(列: - ID)的数据,如下所示。
假设表中有22条记录,那么它将在FastReport的3 * 3网格中显示相同的方式。
I want to display data from table (column :- ID) at FastReport in Grid format as shown below. Suppose there are 22 records in table then it would display same in 3 * 3 grid at FastReport in following manner.
我正在MasterData1频段的主页面使用子报表。在子报表MasterData频段如下
I am using subreport at main page inside MasterData1 band. At subreport MasterData band is as follows
MasterData1乐队
MasterData1 band
TfrxReportPage1 - 列2
TfrxReportPage1 - Columns 2
Subreport - MasterData2属性列3,RowCount 9
Subreport - MasterData2 properties Columns 3 , RowCount 9
但是,当我预览快速报告时,只是在页面上重复相同的数据,如下所示
But when I previewed fast report it is just repeating same data in each grid on page as follows
我正在使用frxDBDataSet1来显示数据(Number of Records 9)。共有28条记录,预计在页面上显示4个3 * 3格,27个ID。而是如上所示在每个3 * 3网格中重复前9个ID。
I am using frxDBDataSet1 to display data (Number Of Records 9). There are in total 28 records so it is expected to show four 3*3 grids on page with 27 IDs. but rather it is repeating first 9 ID's in each 3*3 grid as shown above.
如果我在frxDBDataSet1中设置记录数0,那么它将显示如下所示的
它不是形成3 * 3网格,而是显示数据连续
IF I set Number Of Records 0 at frxDBDataSet1 then it would show something like as below It is not forming 3 * 3 grid but shows data continuou
推荐答案
公共变量声明
public
i: integer;
myid: Array Of Integer;
mydesc: Array Of String;
k: Integer;
rowcount: Integer;
FormCreate事件中的代码
Code at FormCreate event
begin
i := 0;
k := 0;
UniTable1.SQL.Text := 'Select * from userplays';
UniTable1.Execute;
rowcount := UniTable1.RecordCount;
SetLength(myid, rowcount);
SetLength(mydesc, rowcount);
while not UniTable1.Eof do
begin
myid[k] := UniTable1.FieldByName('id').Value;
mydesc[k] := UniTable1.FieldByName('description').Value;
UniTable1.Next;
inc(k);
end;
end.
onGetValue的代码在frxReport
Code at OnGetValue event of the frxReport
var
j: Integer;
begin
j := i div 2;
if j < rowcount then
begin
if (VarName = 'ID1') then
Value := myid[j];
if (VarName = 'DESC1') then
Value := mydesc[j];
end
inc(i);
以上ID1和DESC1是在frxReport备注声明的两个变量,在OnGetValue事件中分配给它的值为全球Array myid& mydesc。全球阵列myid& mydesc在FormCreate事件中填充数据库字段值。
Above ID1 and DESC1 are two variable declared at frxReport memo, value assigned to it at OnGetValue event with the help of global Array myid & mydesc. Global arrays myid & mydesc are filled with database field values at FormCreate event.
这篇关于如何以3 * 3格式的快速报告显示数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!