1

我正在开发一个在日历中显示活动的 iPad 应用程序,并且我有 2 个与此活动相关的 MBO。我能够通过查询+连接获得结果集。但我无法使用 testcriteria 句子获得“where”查询。在我添加 testcriteria 行之前,查询是可以的。这是代码:

SUPQuery *oneActivitiesQuery = [SUPQuery getInstance];
[oneActivitiesQuery select:@"c.DATE_FROM, d.DESCRIPTION"];
[oneActivitiesQuery from:@"GetCalendar" :@"c"];
[oneActivitiesQuery join:@"GetActivityDetail" :@"d" :@"d.GUID" :@"c.GUID"];
oneActivitiesQuery.testCriteria = [SUPAttributeTest match:@"c.DATE_FROM" :d];
SUPQueryResultSet* calendarResultSet = [MBOCRM_MOBILE_MBOCRM_MOBILEDB executeQuery:oneActivitiesQuery ];


if (calendarResultSet  == nil) {
    MBOLog(@"executeQuery failed");
    return;
}


for (SUPDataValueList* result in calendarResultSet ){

    MBOLog(@"Date --> %@", [[SUPDataValue getNullableDate:[result item:0]] description]);  
    MBOLog(@"Description --> %@", [SUPDataValue getNullableString:[result item:1]]);

}

第 5 行中的“d”是一个 NSDate 变量。

这是错误消息:

Terminating app due to uncaught exception 'SUPPersistenceException', reason: 'unexpected null value for '"b"'
4

1 回答 1

0
SUPDateValue *thedatevalue = [SUPDateValue newInstance];
[thedatevalue setValue:d];
oneActivitiesQuery.testCriteria = [SUPAttributeTest match:@"c.DATE_FROM" : thedatevalue];

SUP 不知道某些 NSObjects,您需要转换或包装为 SUP 对象。尝试这个 :)

于 2015-04-28T06:08:32.530 回答