FileMaker:有没有办法在脚本中构建导出订单?
问题:有没有办法在执行脚本时建立导出订单?如果可能的话,我更喜欢 FileMaker 本机或 FileMaker 称为 AppleScript 的解决方案。
项目:该项目是一个报告工具,通过用户可选择的标准(例如:周、季度、年份、位置、产品、供应商等)汇总销售信息(单位、价格、成本)。我想要一种指定方式,在运行时,根据用户选择的标准进行导出。
示例:如果用户选择按供应商每季度汇总的销售单位,我希望能够让脚本选择:
分组依据:
- 季度
- 供应商
导出订单
- 季度
- 单位按季度汇总
- 供应商
- 单位按供应商汇总
显然有很多排列,因此设置为每组选项单独导出一个导出是不可行的。
Question: Is there a way to build an export order while performing a script? I would prefer a FileMaker-native or FileMaker-called AppleScript solution, if one is possible.
Project: The project is a reporting tool which summarizes sales information (units, price, cost) by user-selectable criteria such as: week, quarter, year, location, product, supplier, etc. I would like a way to specify, at runtime, an export based on the user-selected criteria.
Example: If a user selected units sold summarized by supplier per quarter I would like to be able to have the script select:
Group by:
- quarter
- supplier
Export Order
- quarter
- units summary by quarter
- supplier
- units summary by supplier
There are obviously many permutations, so setting up an export for each individual export for each set of options is infeasible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果目标格式是基于文本的(即制表符或逗号分隔),那么我将导出到 XML 并编写 XSLT 来根据需要对其进行总结。为了将参数传递给 XSLT,我通常将一个小的 XML 文件导出到同一文件夹中。
If the target format is text-based (i.e. tab- or comma-separated), then I'd export to XML and write a XSLT to summarize it as necessary. To pass parameters to the XSLT I normally export a small XML file to the same folder.
我能想到的一个解决方案是导出计算而不是原始字段。根据您给出的示例,假设用户最多可以导出两个字段。您创建两个计算字段和两个文本字段。文本字段存储要导出的字段的名称,计算字段使用
Evaluate
(或GetField
)来获取字段的内容。如果您还导出日期和时间字段,事情会变得很复杂,但它仍然可行。如果您需要在导出中包含字段名称,您可以创建一个额外的记录并对该记录进行计算以包含用户已选择的字段的名称。这并非微不足道,但仍然是可能的。
A solution I can think of is to export calculations rather than the original fields. With the example you give, assume that the user can export up to two fields. You create two calculation fields and two text fields. The text fields store the name of the field to export and the calculation fields use
Evaluate
(orGetField
) to get the contents of the fields. It gets complicated if you're also exporting date and time fields, but it's still workable. If you need to include the field names in the export, you create an extra record and work your calculations for that record to contain the names of the fields the user has selected.Not trivial, but still possible.
根据 Mikhail 和 Chuck 的建议,我认为此特定项目的最佳方法是在全局字段中构建 .csv 的内容,然后导出字段内容。我正在做的事情的基本轮廓:
WriteTheRows 是一个自定义函数,它执行以下操作:
我尝试写入的输出可以同时按最多 7 个不同的条件进行排序(例如:我可以按季度汇总供应商销售额,也可以按供应商汇总季度销售额)
WriteALine 是另一个自定义函数,它使用 GetSummary (revenueSummary;Evaluate("summaryField"&summaryFieldNumber)) 添加适当的标签、逗号和值,正如 Chuck 在他的答案中建议的那样。
Building on Mikhail's and Chuck's suggestions, I think the best method for this particular project is going to be to build the contents of a .csv in a global field and then Export Field Contents. The basic outline of what I'm doing:
WriteTheRows is a custom function that does the following:
The output I'm trying to write can be sorted by up to 7 different criteria at the same time (for example: I could summarize supplier sales by quarter or I could summarize quarter sales by supplier)
WriteALine is another custom function which adds the appropriate labels, commas and values using the GetSummary ( revenueSummary ; Evaluate ( "summaryField" & summaryFieldNumber ) as Chuck suggests in his answer.