如何添加表格查询公式?
首先添加表格,参考如何添加表格 - Chinese knowledge space for customer - Confluence (atlassian.net)
这里我们添加这样一张表格,第一列是design的名字,根据不同的design,取到第十列不同的导体类别值,硬銅絞綫/軟銅絞綫。
表格建立好后,给相应的参数建立公式,点击如图的添加新公式。(不是最右边的,最右边是下拉菜单公式,参考如何添加下拉菜单公式 - Chinese knowledge space for customer - Confluence (atlassian.net))
公式类似如下:
conductorCode = cable.c3_conductorCode3_1.value //这里一般是取某个已经有的参数,类似S1010009,某个表格中第一列的值
try {
desc = mixMagic.vlookup("Tables", "Conductor Attributes", conductorCode, 10, "False", "{all}")
} catch(exception) {
desc = ""
}
result = desc
mixMagic.vlookup("Tables", "Conductor Attributes", conductorCode, 10, "False", "{all}")
就是查表的公式语法。
第一个参数“Tables”对应表格的电缆种类,有可能是{all},需要根据表格的电缆种类来看,如图上橙色框。
第二个参数是表格名称。
第三个参数是表格中某个第一列的值,一般是变量
第四个参数是要查询的列,这里是10.
第五个参数是,是否进行范围查询,还是只查询具体完全匹配的值。具体的匹配查询,就填False
第六个参数是表格的工厂,这里是{all},如图上绿色框。
还有一个类似的公式,就是将上一个公式中的查询列,第四个参数,10,换成了表格那一列的名称。
mixMagic.vlookupByHeader("standard", "table", "lookupValue", "columnHeader", "searchByRange", "plant")
mixMagic.vlookupByHeader("Tables", "Conductor Attributes", conductorCode, "導體類別", "False", "{all}")
范围查询
例如如图表
input = 5.4
result = mixMagic.vlookup("Tables", "Armour Braid", input, 3, "True", "{all}")
input 为5.4,结果27. 即0~5.5(不包括5.5),对应27.
5.5~6(不包括6)对应23