我有一个包含成员表、事件表和名为考勤的联接表的Fil怪人数据库,它应该列出哪些成员参加了哪些活动。出席的设置为“允许创建新记录”的成员(不需要它的活动)。
数据到达Excel电子表格以导入到出勤。但我想看看有没有人在我们的记录里.就像这样:
如果我正确理解了它,那么步骤3和步骤4应该如下所示:
Set Variable [ $fname; Value: Attendance::firstname ]
Go To Layout ["Member" (Firstname)]
New Record/Request
Set Field [Member::Firstname; $fname]即将所需的信息放入变量中,在相关表中启动一个新记录,并将那里的数据设置为变量的值。
但是我怎样才能让第二步发生呢?我猜,某种循环将遍历所找到的考勤记录集,并获取相关标识符。如何将它显示给成员表,以查看它是否存在?
发布于 2013-12-03 18:53:28
如果你有很多会员,"Firstname“可能有点轻,可以找到一个独特的成员!因此,我猜想你会对每个成员都有某种独特的密钥。在创建新记录…之前,只需搜索成员库中的成员即可。
发布于 2015-01-24 04:50:47
用相等关系链接这两个表。
写一个脚本:
// Loop through your attendance records.
// Be sure you're in the correct layout
Go to Layout ["imported list"]
// Attempt to go to the membership record of the person who is attending the event.
Go to Related Record [Show only records from: from table: "membership table"; using layout: "membership table"
// If the person who is attending IS in the membership list, you'll go to that member's record in the "membership table."
// If the person who is attending is NOT in the membership list, you'll get an error. You can use that error in an if statement to execute code to add that member.
If [Get ( LastError ) = "101"]
// insert code to add new member
End if发布于 2015-01-25 00:12:01
由于您已经在Member和Attendance之间建立了关系,这意味着您可以在整个关系的考勤表中“看到”任何相关成员。
我们还知道,您只需要评估新的考勤记录,从您的电子表格。
我还假设电子表格中每个成员可能有一个以上的出勤记录。情况可能不是这样,但更安全的是假设这是可能的。
我还假设您通过成员中的主键和出勤中的外键(即Member::ID = Attendance::Member ID )将成员表链接到考勤表。
下面是我建议的脚本过程:
Member记录的查找,即:这假设您已经在考勤布局上,输入find字段成员::ID;"*“省略记录约束查找从这里开始,您可以循环遍历每个出勤记录,并根据需要创建成员记录。
如果在成员Allow creation考勤关系的成员端检查-<,则可以直接从考勤布局中设置成员表中的字段。
由于成员和考勤之间的1到许多关系是1=Member Many=Attendance的,您需要检查以确保您还没有在循环期间创建成员记录,也就是说,如果一个新成员有多个考勤记录,那么您就可以在循环期间创建一个成员记录。
您的循环将如下所示:
Go to Record [First]
Loop
If [IsEmpty(Member::ID)]
Set Field [Member::First Name] // This first Set Field will create your new Member Record as long as the "Allow Creation" is enabled on the Member side
Set Field [Member::Last Name]
... This would be the rest of your set field steps for Member
End If
Go to Record [Next ; Exit After Last]
End Loop这样你就不需要离开你的考勤记录了。此外,两个表的主键和外键将通过关系本身的属性自动创建和设置。
https://stackoverflow.com/questions/14701877
复制相似问题