对 ID 字段重新编号

发布于 2024-11-08 05:57:40 字数 103 浏览 10 评论 0原文

Filemaker 非常新。使用 Filemaker 11 pro。

我想知道在记录之间插入新记录后是否可以对 ID 字段列重新编号?也许使用脚本触发器?

谢谢

Very new to Filemaker. Using Filemaker 11 pro.

I was wondering if it was possible to renumber an ID field column after doing an insert new record in between records? Maybe using a script trigger?

thanks

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

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

发布评论

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

评论(1

遮云壑 2024-11-15 05:57:40

我同意 Jesse 的观点,即对记录的唯一 ID/索引重新编号听起来不是一个好主意,更多信息或您尝试执行的操作示例会有所帮助。

如果您只想显示记录编号,您可以使用计算“Get (RecordNumber)”创建一个未存储的计算字段。这应该始终显示正在显示搜索结果中的哪条记录。 FileMaker 的定义可在此处找到:http://www.filemaker.com/help/html /func_ref2.32.55.html

另一方面,如果您尝试为显示的记录制定唯一的排序顺序,最好通过创建新的 SortIndex 数字字段来实现。 (您需要确保您显示的布局始终按 SortIndex 字段排序,这可以使用布局脚本触发器来完成,并且可能使用自定义菜单覆盖排序菜单命令。)

要考虑的一种方法是使用自定义菜单覆盖新记录命令。选择“新记录”后,您可以将其路由到执行以下操作的脚本:

  1. 获取当前的 SortIndex 值
  2. 获取下一条记录的 SortIndex 值(通过创建一个自连接,显示 SortIndex > SortIndex 的记录)您的视图所基于的表出现次数)
  3. 将这两个值的平均值放入 $variable
  4. 创建一条新记录并将其 SortIndex 设置为 $variable

I agree with Jesse that renumbering a record's unique ID/Index doesn't sound like a good idea and more information or an example of what you're trying to do would help.

If you simply want to display the Record Number, you could create an unstored calculation field with the calculation "Get ( RecordNumber )". This should always display which record, of the found set, is being displayed. FileMaker's definition is available here: http://www.filemaker.com/help/html/func_ref2.32.55.html

If, on the other hand, you're trying to make a unique sort order for the records being shown, it is best to do this by creating a new SortIndex numeric field. (You'd need to make certain that the layout that you're displaying was always sorted by the SortIndex field which can be done using layout script triggers and, possibly, overriding the Sort menu commands using Custom Menus.)

One method to consider would be overriding the New Record command using Custom Menus. When New Record is selected you might route it to a script which does something like this:

  1. Get the current SortIndex value
  2. Get the value of the SortIndex for the next record (by creating a self-join which shows records where the SortIndex > the SortIndex of the table occurrence your view is based on)
  3. Place the average of those two values in a $variable
  4. Create a new record and set its SortIndex to $variable
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文