复杂的逻辑操作未在 filemaker 中提供正确的结果
Complex logic operation is not providing the right results in filemaker
我尝试使用脚本过滤 FileMaker 中的记录,在该脚本中我循环遍历所有记录并过滤掉不需要的记录。
我正在使用以下脚本(我使用的是荷兰语版本,所以我不确定 exact/correct 英文代码是什么。我的道歉):
Go to record/page [First]
Loop
If [
db1::field1 = "valueA" or
db1::field2 = "ValueB" or
(db1::field3 ≠ "ValueC" and db1::field4 ≠ "ValueC")
]
Omit record
End If
Go to record [Next; Stop after last: On]
End Loop
当 运行 脚本时,我没有得到正确的结果。例如,我确实在以下位置获取记录:
- 字段 1 是 "ValueA"
- field3 不是 "ValueD".
此外,当我多次应用脚本时,每次保留的记录数都越来越少。即使逻辑没有改变!
有人知道这里出了什么问题吗?
我怀疑你的 goto next record 脚本步骤有错误,你没有在这里显示。如果在执行省略后执行转到下一条记录,则可能会跳过额外的记录。
Post剩下的循环结构让我们可以看到整个过程。
P.S。您不需要在 if 语句中使用括号,因为您只有 OR 运算符。
编辑:仔细观察你的逻辑,假设我理解你的需求,我认为它不会做你想要的。
试试这个:
(db1::field1 = "valueA" or db1::field2 = "ValueB")
and
db1::field3 ≠ "ValueC" and db1::field3 ≠ "ValueD"
编辑 2:
Go to record/page [First]
Loop
If [
(db1::field1 = "valueA" or db1::field2 = "ValueB") and
db1::field3 ≠ "ValueC" and db1::field4 ≠ "ValueC"
]
Omit record
Else [
Go to record [Next; Stop after last: On]
]
End If
End Loop
我尝试使用脚本过滤 FileMaker 中的记录,在该脚本中我循环遍历所有记录并过滤掉不需要的记录。
我正在使用以下脚本(我使用的是荷兰语版本,所以我不确定 exact/correct 英文代码是什么。我的道歉):
Go to record/page [First]
Loop
If [
db1::field1 = "valueA" or
db1::field2 = "ValueB" or
(db1::field3 ≠ "ValueC" and db1::field4 ≠ "ValueC")
]
Omit record
End If
Go to record [Next; Stop after last: On]
End Loop
当 运行 脚本时,我没有得到正确的结果。例如,我确实在以下位置获取记录: - 字段 1 是 "ValueA" - field3 不是 "ValueD".
此外,当我多次应用脚本时,每次保留的记录数都越来越少。即使逻辑没有改变!
有人知道这里出了什么问题吗?
我怀疑你的 goto next record 脚本步骤有错误,你没有在这里显示。如果在执行省略后执行转到下一条记录,则可能会跳过额外的记录。
Post剩下的循环结构让我们可以看到整个过程。
P.S。您不需要在 if 语句中使用括号,因为您只有 OR 运算符。
编辑:仔细观察你的逻辑,假设我理解你的需求,我认为它不会做你想要的。
试试这个:
(db1::field1 = "valueA" or db1::field2 = "ValueB")
and
db1::field3 ≠ "ValueC" and db1::field3 ≠ "ValueD"
编辑 2:
Go to record/page [First]
Loop
If [
(db1::field1 = "valueA" or db1::field2 = "ValueB") and
db1::field3 ≠ "ValueC" and db1::field4 ≠ "ValueC"
]
Omit record
Else [
Go to record [Next; Stop after last: On]
]
End If
End Loop