FileMaker - 查找第一个相关记录的主键

发布于 2024-10-03 00:05:39 字数 430 浏览 6 评论 0原文

我正在使用脚本创建新的 Invoice 记录。我想自动将发票的 fClient fContactID 列设置为客户首次联系人的 ID。

在我的脚本中,如何查找/计算客户第一次联系的 ID?计算结果为 Min(Contact_Invoice Contact::ContactID) 的 SetField 不起作用。

表格:
客户端 - 主键:ClientID
联系人 - 有外键:fClientID(一个客户端可以有多个联系人)
Invoice - 有外键:fClientID & fContactID(发票与一位客户以及该客户的联系人之一相关联)

谢谢,

I'm using a script to create a new Invoice record. I'd like to automatically set the invoice's fClient fContactID column to the ID of the client's first contact.

In my script, how would I find/compute the ID of the client's first contact? SetField with a calculated result of Min(Contact_Invoice Contact::ContactID) didn't work.

Tables:
Client - primary key: ClientID
Contact - has foreign key: fClientID (a client can have many contacts)
Invoice - has foreign keys: fClientID & fContactID (an invoice is associated with one client and with one of that client's contacts)

Thank you,
Ben

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

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

发布评论

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

评论(1

ゞ花落谁相伴 2024-10-10 00:05:39

您说您想设置“fClientID”,但从您的描述来看,听起来更像是您想设置fContactID。是这样吗?

如果是这种情况,那么您就有一张与客户相关的发票,该发票与联系人直接相关。你所做的事情是正确的,但如果不起作用,那么你的环境就不正确。您当时的上下文是发票表,因此需要从那里访问相关的联系人。

您还可以使用自动输入计算而不是脚本来设置它。额外的好处是,这只会让您选择有效的上下文和相关表。

You say you want to set the "fClientID", but from your description it sound more like you're wanting to set the fContactID. Is that right?

If that's the case, then you have an Invoice, related to a Client, which is directly related to a Contact. What you're doing is right, but if it's not working then your context isn't right. Your context at the time is the Invoice table, so the related Contact needs to be accessible from there.

You could also use an auto enter calc instead of a script to set this. Extra bonus is that this will only let you select a valid context and related table.

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