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

发布于 2024-11-07 15:38:32 字数 464 浏览 3 评论 0原文

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

我正在尝试使用 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;

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

提前致谢。

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,

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

探春 2024-11-14 15:38:32

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

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


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

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

您可以做的是:

First_Record;
Duplicate_Record;

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

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.

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.


"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).

What you could do is:

First_Record;
Duplicate_Record;

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

鹿港巷口少年归 2024-11-14 15:38:32

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

First_Record;
创建记录;
Duplicate_Record;

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

APC's solution should work, with one modification:

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文