FastReport VCLで用紙いっぱいまで空行を出力したい

129 views
Skip to first unread message

太田@Gracix

unread,
Jun 2, 2020, 5:30:07 AM6/2/20
to Japan RAD Studio User Group
太田です。

FastReport 5.0で帳票を作成しているのですが、用紙いっぱいまで空行を出力する方法がわかりません。

用紙には10行分の高さがあり、データ個数がそれ以下の場合でも10行分を表示したいのですが、
2個の場合は2行しか出力しません。

MasterDataにChildバンドを付け、それを指定個数出力させるような表記も見かけましたが、
空白があってもChildは1つのみしか出力されませんでした。

設定方法がおわかりになる方はいらっしゃいますか?



ohtaka

unread,
Jun 3, 2020, 12:25:45 AM6/3/20
to Japan RAD Studio User Group
ohtaka ともうします
よろしくお願いします。

たぶん Database(SQL) をお使いでしょうから、発想を変えて固定行数を返すようにしたらどうでしょう。

Orcale12 での動作確認をしています。
他のDBでしたら from dual と nvl あたりの変更が必要と思います。
 where seq_tbl.idx < 10 の数値を変更すれば固定行数が変えられます。

参考にしてみてください。
----
create table test_tbl (
  key number(6),
  idx number(4),
  item varchar2(10)
);

insert into test_tbl values (1,1,'001-1');
insert into test_tbl values (1,2,'001-2');
insert into test_tbl values (2,1,'002-1');
insert into test_tbl values (2,2,'002-2');
insert into test_tbl values (2,3,'002-3');
insert into test_tbl values (3,1,'003-1');

with seq_tbl(idx) as (
select 1 as idx from dual
  union all
    select seq_tbl.idx+1
      from seq_tbl
     where seq_tbl.idx < 10
)
select A.key, A.idx, nvl(test_tbl.item, '') item
  from (
    select test_tbl.key key,
           seq_tbl.idx idx
      from seq_tbl, test_tbl
     group by test_tbl.key, seq_tbl.idx
  ) A
      left outer join test_tbl
              on A.key = test_tbl.key
             and A.idx = test_tbl.idx
 order by A.key, A.idx
;

drop table test_tbl;
----

直接 Delphi とは関係ないですね(^_^;


2020年6月2日火曜日 18時30分07秒 UTC+9 太田@Gracix:

太田@Gracix

unread,
Jun 3, 2020, 5:56:01 AM6/3/20
to Japan RAD Studio User Group
ohtakaさん

ヒントをありがとうございます!
なるほど、こういう方法もありますね。

ただ、今回はSQL側はあまりいじりたくない状態でして、
FastReport側でなんとかできないかと考え中です。

迂回路として参考にさせていただきます!



2020年6月3日水曜日 13時25分45秒 UTC+9 ohtaka:
Reply all
Reply to author
Forward
0 new messages