【发布时间】:2018-09-08 02:38:49
【问题描述】:
在 Zoho Creator 中,我有两个需要链接在一起的表单。
表格 A: 是一个奖励计数器,其中某些问题会获得一定的分数,并且每次输入都会存储在一个名为“Points_Earned”的列中。
Form B:是一个身份数据库,包含个人的基本详细信息,例如姓名、DB 成员资格等。
两个表单之间的PK是一个Person Identity,格式为"UID - Lastname, Firstname"(这些字段在Form B中作为单独的列出现,但在Form A中,在下拉框中显示为一个串联字符串,字段名称为Reward_Member)。
目标:
Form B 有一个名为Total_Points 的列,它需要显示特定UID 的所有Points_Earned 的总和。
SQL 表达式类似于:select SUM(Points_Earned) from Form_A where Reward_Member = Form_B.UID + " - " + Form_B.Lastname + ", " + Form_B.Firstname;
问题:
我不确定如何在 Deluge 中执行上述逻辑。 我尝试了聚合方法,但它似乎没有计算记录的总和,知识库文章也没有太大帮助。 结果保持空白。
这是我用来显示总和的脚本(放在 EDIT>>ON_LOAD 中):
//Variables
curpts = 0;
emp_lookup_val = input.Employee_ID + " - " + input.First_Name + ", " + input.Last_Name;
//Perform the sum aggregation function
curpts = Add_Loyalty_Entry[Reward_Member == input.Employee_ID].sum(Points_Earned);
//Set the Text Field Total_Points with the calc result
input.Total_Points = curpts;
示例数据:
表格 A:
+---------------+---------------+
| Reward_Member | Points_Earned |
+---------------+---------------+
| 1 - Doe, John | 3 |
| 1 - Doe, John | 2 |
| 4 - Crow, Bob | 1 |
+---------------+---------------+
表格 B:
+-----+-----------+----------+
| UID | Firstname | Lastname |
+-----+-----------+----------+
| 1 | John | Doe |
| 4 | Bob | Crow |
+-----+-----------+----------+
调试信息
我用下面的表达式看看Reward_Member中存储的数据是什么样子的,得到了表达式后显示的结果:
表达式:alert input.Reward_Member.toString() + " earned " + input.Points_Earned + " Point(s).";
结果:3485853000000015046 earned 1 Point(s). ... 看起来像 BigInt
【问题讨论】:
标签: aggregate-functions biginteger zoho deluge