在 Oracle Form 中选择文本项的 LOV 后自动填充文本项
Auto fill text-items after LOV selection for a text-item in an Oracle Form
考虑一个包含 3 个文本项的 Oracle 表单。首先是 'PO Number' 字段,用户通过文本项旁边的按钮调用 LOV 输入该字段。第二个是 'Supplier Code' 对应采购订单编号 selected 的文本项,第三个是 'Supplier Name' 对应于该供应商代码的文本项。
实际 _PO_Number_ 和 _Supplier_Code_ 存在于数据库中的相同 table 中,但 _Supplier_Name_ 存在于不同的 table 中。我想要的只是当我 select 来自 LOV 的 PO 编号 时,剩余的 2 个字段应该相应地自动填充。
我应该使用什么触发器?我应该在哪里使用它以及我应该考虑哪些其他事项?请帮助我,因为我是 Oracle Forms 的菜鸟。
你有几种可能会产生一些后果
- 直接在 WHEN-BUTTON-PRESSED 触发器中设置 _Supplier_Code_ 和 _Supplier_Name_ 在用户 selects _PO_Number_
之后你的按钮上
后果 - 当用户按下标准 KEY-LISTVAL 时,代码将不会 运行、Supplier*_ items remain空
像这样在 _PO_Number_ 上写 WHEN-VALIDATE-ITEM
declare
cursor c is select _Supplier_Code_, _Supplier_Name_
from suppliers_table
where _PO_Number_ = :your_block._PO_Number_;
begin
open c;
fetch c into :your_block._Supplier_Code_, :your_block._Supplier_Name_;
close c;
end;
后果 - 当 _PO_Number_ 项目发生变化时,此代码 运行 始终有效。如果_Supplier_Code_是一个数据库项,它可能会在从数据库中查询记录后将其状态更改为UPDATE。
- select _Supplier_Code_ 和 _Supplier_Name_ 项目直接在 LOV 中。将您的 select 写为两个表的连接。将所有三项设置为 return 项。如果您不想在 LOV 中向用户显示 _Supplier_Code_ 和 _Supplier_Name_,只需将它们的宽度设置为 0
我更喜欢解决方案 3。
如果我没记错的话,您可以在创建 LOV 时指定 table 指的是哪个 'suplier_code',在将 sql 代码写入 select 必要的参数,然后 select 需要的行到 'look up return item' 字段
考虑一个包含 3 个文本项的 Oracle 表单。首先是 'PO Number' 字段,用户通过文本项旁边的按钮调用 LOV 输入该字段。第二个是 'Supplier Code' 对应采购订单编号 selected 的文本项,第三个是 'Supplier Name' 对应于该供应商代码的文本项。
实际 _PO_Number_ 和 _Supplier_Code_ 存在于数据库中的相同 table 中,但 _Supplier_Name_ 存在于不同的 table 中。我想要的只是当我 select 来自 LOV 的 PO 编号 时,剩余的 2 个字段应该相应地自动填充。
我应该使用什么触发器?我应该在哪里使用它以及我应该考虑哪些其他事项?请帮助我,因为我是 Oracle Forms 的菜鸟。
你有几种可能会产生一些后果
- 直接在 WHEN-BUTTON-PRESSED 触发器中设置 _Supplier_Code_ 和 _Supplier_Name_ 在用户 selects _PO_Number_ 之后你的按钮上
后果 - 当用户按下标准 KEY-LISTVAL 时,代码将不会 运行、Supplier*_ items remain空
像这样在 _PO_Number_ 上写 WHEN-VALIDATE-ITEM
declare cursor c is select _Supplier_Code_, _Supplier_Name_ from suppliers_table where _PO_Number_ = :your_block._PO_Number_; begin open c; fetch c into :your_block._Supplier_Code_, :your_block._Supplier_Name_; close c; end;
后果 - 当 _PO_Number_ 项目发生变化时,此代码 运行 始终有效。如果_Supplier_Code_是一个数据库项,它可能会在从数据库中查询记录后将其状态更改为UPDATE。
- select _Supplier_Code_ 和 _Supplier_Name_ 项目直接在 LOV 中。将您的 select 写为两个表的连接。将所有三项设置为 return 项。如果您不想在 LOV 中向用户显示 _Supplier_Code_ 和 _Supplier_Name_,只需将它们的宽度设置为 0
我更喜欢解决方案 3。
如果我没记错的话,您可以在创建 LOV 时指定 table 指的是哪个 'suplier_code',在将 sql 代码写入 select 必要的参数,然后 select 需要的行到 'look up return item' 字段