Zoho是一个用于快速创建简单云应用程序的伟大系统。但是,我遇到了子表单的问题:目前,Zoho没有提供按指定列对子表单记录进行排序的功能。相反,它按添加记录的顺序对记录进行排序。
我的子表单是一个Creator表单,它链接到另一个Creator表单(基本上是两个不同的表)。表单通过双向查找关系链接。
我见过并尝试过实施这些“黑客”,但没有一个适合我的情况:
我还打电话给Zoho技术支持部门,在查看了我的应用程序后,他们说目前不可能对子表单记录进行排序。
还有其他想法吗?
发布于 2014-01-03 04:51:31
我的测试解决方案仍然是一个黑客,但在Zoho实现了通过GUI对子表单记录排序的方法之前,这将不得不这样做。
首先,创建一个可以从任何地方调用的函数(例如,添加或更改一个新的子表单记录时)--有关这方面的详细信息,请访问此处:http://www.zoho.com/creator/help/script/functions.html。
该函数将首先通过父记录ID (按适当的列进行排序)复制子表单记录,然后删除脚本启动前插入的所有子表单记录:
int SubFormRecords_SortByAnything_ReturnCount(int ParentRecordID)
{
scriptStartTime = zoho.currenttime;
for each rSubFormRecord in SubFormRecords [ParentFieldName = input.ParentRecordID] sort by FieldName1, FieldName3, FieldName2
{
NewSubFormRecordID = insert into SubFormRecords
[
FieldName1 = rSubFormRecord.FieldName1
FieldName2 = rSubFormRecord.FieldName2
FieldName3 = rSubFormRecord.FieldName3
];
}
delete from SubFormRecords[ (Series == input.ParentRecordID && Added_Time < scriptStartTime) ];
return SubFormRecords[ParentFieldName == input.EventID].count();
}一旦上述排序功能到位(为您的应用程序定制),适当时调用它。当添加与子窗体关联的记录或更改排序列值时,我调用它。
这很好,而且只要您没有与添加和删除记录相关的复杂逻辑,它对应用程序性能的影响就应该最小。
请让我知道这是否适合你,如果你有更好的想法。
警告:此解决方案不适用于包含其他子表单记录的表单,因为删除这些记录将删除链接的子表单值。
谢谢。
发布于 2021-05-11 06:33:06
I have a a very simple workaround:
1) You have to add a Form Workflow
2)Record Event - Create OR Edit OR Create/Edit (As per your requirement)
3)Form Event - On successful form submission
4)Let Main_Form be the link name of the Main Form
4)Let Sub_Form be the Link name of the Sub Form (Not the link name you specify in the main form for the same sub form)
4)Let Field1 and Field2 are fields of subform on which you want to sort subform records
5)Let Link_ID be lookup field of Mainform ID in the subform
Workflow
1)Sub_Records = Sub_Form[Link_ID == input.ID] sort by Field1,Field2;
(sort by multiple fields, add asc/desc as per requirement)
2)delete from Sub_Form[Link_ID == input.ID];
3)for each sub_record in Sub_Records
{
insert into Sub_Form
[
Added_User = zoho.loginuser
Link_ID = input.ID
Field1 = sub_record.Field1
Field2 = sub_record.Field2
]
}
//Now you check the results in edit view of the main formhttps://stackoverflow.com/questions/20693110
复制相似问题