oracle 如何从特定项目实例中获取价值?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6043559/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 23:42:11  来源:igfitidea点击:

How can i get value from specific item instance?

oracleoracleforms

提问by CrazyDiamond

I'm trying to create multi-item database based form. When i open it, it will be populated by one record only, always. And i want functionality in it, that will fill all fields of new created record, same as they are in the first (selected from DB) record. Just copy them from the first record, that's it.

我正在尝试创建基于多项目数据库的表单。当我打开它时,它将始终仅由一条记录填充。我想要它的功能,它将填充新创建的记录的所有字段,与第一个(从数据库中选择的)记录中的字段相同。只需从第一条记录复制它们,就是这样。

I'm trying to use WHEN-NEW-ITEM-INSTANCE trigger and ":system.record_status IN ('NEW','INSERT')" condition, but i don't know, how to tell Forms, that i need value from my first record. I mean,

我正在尝试使用 WHEN-NEW-ITEM-INSTANCE 触发器和 ":system.record_status IN ('NEW','INSERT')" 条件,但我不知道如何告诉表单,我需要来自我的第一张唱片。我的意思是,

IF :system.record_status IN ('NEW','INSERT')
THEN
  :block.item := <<here goes pointer to my first record of that item>>
END IF;

So, how can i get value from specific item instance?

那么,我如何从特定的项目实例中获取价值?

Thanks in advance.

提前致谢。

回答by APC

Create a dummy block, one that is invisible to the users. Populate it with your default record as part of the WHEN-NEW-FORM-INSTANCE trigger.

创建一个虚拟块,一个对用户不可见的块。作为 WHEN-NEW-FORM-INSTANCE 触发器的一部分,用您的默认记录填充它。

Then in your actual DATA block you can reference the items in the dummy block to pre-populate the items. I would probably choose to use a higher level trigger such WHEN-CREATE-RECORD rather than having a swarm of WHEN-NEW-ITEM-INSTANCE triggers, but it depends on how the rest of your design hangs together.

然后在您的实际 DATA 块中,您可以引用虚拟块中的项目来预填充这些项目。我可能会选择使用更高级别的触发器,例如 WHEN-CREATE-RECORD,而不是使用一大群 WHEN-NEW-ITEM-INSTANCE 触发器,但这取决于设计的其余部分如何结合在一起。



"Thats a crude solution"

“这是一个粗略的解决方案”

Sorry, I hadn't realised that you were displaying the default record to the users. However, as far as I know Forms does not have any mechanism to reference a record other than the current record (full disclosure: I haven't actually used Forms for a while and I don't have access to test whether this is still the case).

抱歉,我没有意识到您正在向用户显示默认记录。但是,据我所知,Forms 没有任何机制来引用当前记录以外的记录(完全披露:我已经有一段时间没有实际使用过 Forms,我无权测试这是否仍然是案件)。

What you could do is:

你可以做的是:

First_Record;
Duplicate_Record;

This also has a downside, as the user may find the navigation jump confusing.

这也有一个缺点,因为用户可能会发现导航跳转令人困惑。

回答by AndyDan

APC's solution should work, with one modification:

APC 的解决方案应该可以工作,只需进行一项修改:

First_Record;
Create_Record;
Duplicate_Record;

First_Record;
Create_Record;
Duplicate_Record;

Duplicate_Record always copies the previous record to the current record, not necessarily to a new record. Create_Record will, obviously, create that new record for you.

Duplicate_Record 总是将前一条记录复制到当前记录,不一定复制到新记录。显然,Create_Record 将为您创建新记录。