You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否在FileMaker中将字段本身(而非内容)存储为变量?

解决方案:在FileMaker中用变量存储字段引用重构脚本

完全可以通过Set Variable存储字段本身的引用,而非字段内容,以此简化你的多分支脚本。具体做法是用文本形式存储字段的完整标识符(表名::字段名),再让Insert File操作引用这个变量作为目标字段。

重构后的脚本示例

Set Error Capture [On]
Allow User Abort [Off]

Set Variable [$ScriptParameter; Value: Get (ScriptParameter)]
Set Variable [$TargetField; Value: ""] // 初始化变量

If [$ScriptParameter = "Clean"]
    Set Variable [$TargetField; Value: "Inspections::cert_Clean"]
Else If [$ScriptParameter = "C of C"]
    Set Variable [$TargetField; Value: "Inspections::cert_C of C"]
Else If [$ScriptParameter = "Hardness"]
    Set Variable [$TargetField; Value: "Inspections::cert_Hardness"]
// 其他分支按此格式添加
...
End If

// 统一执行插入操作,目标指向变量存储的字段引用
If [$TargetField ≠ ""]
    Insert File [Insert; Display content; Never compress; Target: $TargetField]
End If

关键注意点

  • 字段引用必须是完整标识符:格式为表名::字段名,需和数据库中实际的表、字段名称完全一致(FileMaker对大小写不敏感,但建议严格匹配避免意外)
  • 增加$TargetField ≠ ""的判断,可避免脚本参数无效时执行空插入操作
  • 所有Insert File的参数(插入方式、显示内容、压缩设置)统一在最后一步配置,避免重复代码,后续修改只需改动这一处

内容的提问来源于stack exchange,提问作者NewBoard

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 18:52:46