使用数组错误的甲骨文表单



我正在使用Oracle Forms and Reports。我是初学者。

我有一个表invoice有字段INVNOINVDATE

发票表:

Invno    Invdate
INVNO1   03/03/2017

另一个具有这些字段的表:

Passing

Invno       debitcode  credit    amount sln 
INVNO1      debit1     credit1   100    1
INVNO1      debit2     credit2   200    2 
INVNO1      debit3     credit3   150    3
INVNO1      debit4     credit4   250    4 

debitcredit的记录数可能会有所不同,最大记录数为 7。

在表单中,我想根据记录数显示水平记录行

Invoice No Debit1 Credit1 Amount Debit2 credit2 Amount ..Debit4 Credit4 
表单

不能做任何"动态"的事情,所以你必须对所有 7 个贷方/借方值进行硬编码,例如这个(我已经完成了多达 3 个值(。我建议您基于此类查询创建一个视图

SQL> with passing (invno, debit, credit, amount, sln) as
  2    (select 'invno1', 'debit1', 'credit1', 100, 1 from dual union
  3     select 'invno1', 'debit2', 'credit2', 200, 2 from dual union
  4     select 'invno1', 'debit3', 'credit3', 150, 3 from dual union
  5     select 'invno1', 'debit4', 'credit4', 250, 4 from dual)
  6  select invno,
  7    max(decode(sln, 1, debit)) debit1,
  8    max(decode(sln, 1, credit)) credit1,
  9    max(decode(sln, 1, amount)) amount1,
 10    --
 11    max(decode(sln, 2, debit)) debit2,
 12    max(decode(sln, 2, credit)) credit2,
 13    max(decode(sln, 2, amount)) amount2,
 14    --
 15    max(decode(sln, 3, debit)) debit3,
 16    max(decode(sln, 3, credit)) credit3,
 17    max(decode(sln, 3, amount)) amount3
 18  from passing
 19  group by invno;
INVNO  DEBIT1 CREDIT1    AMOUNT1 DEBIT2 CREDIT2    AMOUNT2 DEBIT3 CREDIT3    AMOUNT3
------ ------ ------- ---------- ------ ------- ---------- ------ ------- ----------
invno1 debit1 credit1        100 debit2 credit2        200 debit3 credit3        150

截至报告:嗯,最简单的选择是重用您在表单中使用的查询(或视图,正如我所建议的那样(。或者,如果您愿意,可以创建一个能够动态执行此操作矩阵报表

附言哦,是的 - 忘了问:标题说"错误"。哪个错误?您没有指定它。

最新更新