Google 应用制作工具总计字段

Google App Maker Total field

我有一个筛选列表,如下面的屏幕截图所示

screenshot of the filtered list

我想在单独的字段中计算总计 "Km"。

你能帮帮我吗?

这是小部件结构的屏幕截图:

Structure Admin View

像下面这样的东西会起作用:

TableListWidget.children._values
  .map(function(obj){ 
    return parseInt(obj.descendants.nameOfYourKMField.value);
  })
  .reduce(function(accumulator, currentValue){ 
    return accumulator + currentValue; 
  });

TableListWidget.children._vaues 包含所有 table 行的数组,每行的 descendants 属性 将包含具有您的 KM 值的小部件。我们将 _values 数组映射到 KM 字段值数组,然后使用 reduce 函数添加它们。