本帖最后由 bess 于 2012-12-31 09:21 编辑
Q:如何获取主子表单中子表单的记录的记录条数
A:可以通过当前文档对象获取子表单的对象,然后直接获取子表单对象的大小即可.具体代码如下:
- //该方法写在函数库中,比如新建一个函数库名称为getChilds,
- /**
- * 根据子文档名,获取当前文档的子文档个数
- *
- * @return 根据子文档名,获取当前文档的子文档个数
- *
- * @param formName
- * 当前打开文档的子文档名
- */
- function countSubDocument(formName) { //方法名,带参的方法,该参数传子表单的名称
- var doc = $CURRDOC.getCurrDoc();
- var total = 0;
- if (doc != null) {
- if (doc != null) {
- var subdocs = doc.getChilds(formName); //当前打开文档的子文档名
- if (subdocs != null && subdocs.size() > 0) {
- total = subdocs.size();
- }
- }
- }
- return total;
- }
复制代码 ps:调用语法:
#include "getChilds"; //#include "函数库名";
countSubDocument(formName); //函数名(参数) |