AR System Java API设置max_Retrieve、sort_list后查询返回0条目问题
AR System Java API
getListEntryObjects 接口返回0条问题排查与修复方案 问题根因
- 核心参数配置错误:
max_Retrieve传0属于AR System API的明确语义:即要求接口返回0条符合条件的结果,这是返回空的最直接原因 - 查询条件参数笔误:代码中定义的查询条件变量为
qualificationString,但调用接口时传入的是未在代码片段中声明的qualification变量,会导致实际查询条件为空/无效,也会触发返回0条 - 其他潜在原因:
sort_list传null属于合法参数,不会导致返回空;如果修复上述两个问题后仍无结果,需要检查ARServerUser上下文是否完成登录初始化、登录账号是否有表单读权限、entryId是否为合法的条目ID
修复方案
调整代码如下即可正常获取数据:
String formName = "some_formname"; // 确认entryId值合法,拼接的查询条件可先在AR搜索界面验证有效性 String qualification = "$1$ = \"" + entryId + "\""; int firstRetrieve = 0; // 设为-1(对应常量AR_NO_MAX_LIST_RETRIEVE)表示返回所有符合条件的条目,也可传入正整数指定最大返回条数 int max_Retrieve = -1; // 无需排序可保持为null,需要排序时再构造SortInfo列表传入 List sort_list = null; boolean UseLocale = false; OutputInteger nmatches = new OutputInteger(); // 确认context已完成登录初始化,服务器、账号、密码配置正确 ARServerUser context = new ARServerUser("username", "password", "", "serverAddress", port); List<AREntry> Myentries = context.getListEntryObjects(formName, qualification, firstRetrieve, max_Retrieve , sort_list, fieldIds, UseLocale, nmatches); // 调用nmatches.getValue()可获取符合条件的总条目数
内容的提问来源于stack exchange,提问作者Karthik G Sarode
相关产品推荐
相关产品推荐

