如何在 FileMaker 表中创建新的主键,然后将现有关系修改为基于新创建的键?
我有相当的要求。开发人员创建了我们的数据库,该数据库具有多个布局,并且关系树非常混乱。如果有另一个开发人员进来看看,他说解构我们的系统太耗时、太痛苦,现在考虑创建一个脚本,这样你就可以解决它,直到它被修复。困境如下:我在一个页面上获得了信息,而该页面应该利用选项卡和门户来引用许多不同页面上的信息。然而,所有信息都链接到用户名。该用户名不是静态/序列化的或什么的。因此,如果没有立即发现问题,大量信息可能会链接到此人的“页面”。如果名称不正确,并且有人试图稍微更改用户名,就会破坏这种关系并开始新的关系。这些信息不会消失,但它基本上处于不确定状态,直到您将名称改回原来的名称。我实际上尝试过导出信息,更改不匹配的信息,即将名称从 Jon.Smith 更改为 John.Smith,然后将信息导入到该人的新“页面”,但结果不成功。这让我想到了我的问题,脚本能够解决这个问题吗?同样,对于如何创建这个脚本有什么建议吗?我很抱歉,但我对数据库管理的经验很少,并且不确定为什么这个项目落在我身上。任何帮助将不胜感激。
I have quite the request. A developer created our database that has multiple Layouts with a relationship tree that is very messy. Had another developer come in, take a look at it, he said that it would be too time consuming and painful to deconstruct our system, consider creating a script for now so that you can work around it until it can be fixed. Here's the dilemma: I've got information on one page that is supposed to reference information on a number of different pages utilizing tabs and portals. However, all the information is linked to a username. This username is not static/serialized or what have you. Therefore, if the issue is not caught right away a great deal of information can be linked to this person's 'page'. If the name is incorrect and someone tries to alter the username even slightly, it breaks that relationship and starts a new one. The information does not disappear, but it is basically sitting in limbo somewhere until you change the name back to the original. I've actually tried exporting the information, changing the information that doesn't match, i.e. changing a name from Jon.Smith to John.Smith, and then importing the information to a new 'page' for that person with unsuccessful results. Which brings me to my question, is a script going to be able to fix this problem? Likewise, are there any suggestions to how to create this script? I apologize, but I have very little experience with DataBase management at all, and am not sure why this project fell upon me. Any help would be GREATLY appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
评论(2)
好吧,作为一般性答案,用户在 FileMaker 中可以执行的任何操作(我所说的用户是指非开发人员,因此定义数据库结构、编写脚本等活动不包括在内)都可以编写脚本。因此,如果您能够通过重置字段的值来“解决”问题,那么,是的,脚本可以做到这一点。
关于您的具体问题,脚本可能不需要导出记录,但可以重置 FileMaker 中字段的值。这可以通过循环遍历需要更改的记录或使用替换字段内容脚本步骤来完成。因此,脚本可以执行以下操作:
Go to Layout[MyLayout] // Go to a layout that is attached to the table you need to search.
Perform Find[Restore] // Restore a find that will show the records you need to change.
Replace Field Contents[Table::Field; "New Value"]
提供比这更多的建议需要实际查看数据库并更多地了解您的特定需求。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
wchsTech4,你很幸运,因为你的问题很容易解决。您甚至不需要脚本。
首先备份您的文件。然后:
1)创建两个新字段:
2)为person表中新的id字段生成序号。
3) 将刚刚生成的序列号放入相关表中。
4)改变关系。
5)测试一切。应该有效。
您的相关记录有可能以这样的方式创建,您还需要修改脚本、网站或此处未提及的其他内容才能继续进行修复工作。调查这一点很重要。
wchsTech4, you are in luck because your problem is easy to fix. You don't even need a script.
BACK UP YOUR FILE(S) FIRST. Then:
1) Create two new fields:
2) Generate serial numbers for the new id field in the person table.
3) Place the serial numbers you just generated in the related table.
4) Change the relationship.
5) Test everything. Should work.
There is a chance that your related records are being created in such a manner that you also need to modify a script, website, or something else not mentioned here to have your fix work going forward. That is important to investigate.